Commit Graph

64 Commits

Author SHA1 Message Date
Calen Pennington
b353ed2ea2 Better support specifying of modulestore configuration in test cases
The existing pattern of using `override_settings(MODULESTORE=...)` prevented
us from having more than one layer of subclassing in modulestore tests.

In a structure like:

    @override_settings(MODULESTORE=store_a)
    class BaseTestCase(ModuleStoreTestCase):
        def setUp(self):
            # use store

    @override_settings(MODULESTORE=store_b)
    class ChildTestCase(BaseTestCase):
        def setUp(self):
            # use store

In this case, the store actions performed in `BaseTestCase` on behalf of
`ChildTestCase` would still use `store_a`, even though the `ChildTestCase`
had specified to use `store_b`. This is because the `override_settings`
decorator would be the innermost wrapper around the `BaseTestCase.setUp` method,
no matter what `ChildTestCase` does.

To remedy this, we move the call to `override_settings` into the
`ModuleStoreTestCase.setUp` method, and use a cleanup to remove the override.
Subclasses can just defined the `MODULESTORE` class attribute to specify which
modulestore to use _for the entire `setUp` chain_.

[PLAT-419]
2015-02-04 09:09:14 -05:00
Calen Pennington
03a05fd9d4 Always call super(..).setUp() from setUp 2015-02-04 09:09:14 -05:00
David Baumgold
36e77c7463 Fixing pep8 issues 2014-12-11 13:04:49 -05:00
Andy Armstrong
eced849db0 Add group_access field to all xblocks
TNL-670
2014-12-05 09:55:00 -05:00
jsa
f24f01d217 Add support for user partitioning based on cohort.
JIRA: TNL-710

IMPORTANT: this commit converts the course_groups
package to using migrations.  When deploying to an
existing openedx instance, migration 0001 may fail
with an error indicating that the CourseUserGroup
table already exists.  If this happens, running
the 0001 migration first, with the --fake option,
is recommended.  After performing this step,
remaining migrations should work as expected.
2014-12-05 09:53:44 -05:00
Jesse Zoldak
bf3b87bc64 Clean up all modulestore testcases
Move modulestore config for tests to an importable location
Disable pylnt warning for lms imports in common tests
Refactor all testcases that loaded all xml courses
TE-610
TE-489
2014-12-02 07:09:36 -05:00
Sarina Canelake
d14c39a13e Fix exposed pylint violations 2014-12-01 11:22:10 -05:00
Sarina Canelake
b127d2844b s/pylint: disable=C0103/pylint: disable=invalid-name/ 2014-12-01 11:22:09 -05:00
stv
cf9308144d Fix PEP8: E302 expected 2 blank lines, found 1 2014-11-10 11:00:11 -08:00
polesye
f039341d21 TNL-549: Fix thread editing. 2014-10-03 23:27:15 +03:00
Don Mitchell
4ca5012f3c Use split to test views 2014-09-29 11:25:55 -04:00
jsa
d3d4d33064 Ensure group info is present in LMS responses.
TNL-24
2014-09-12 13:47:05 -04:00
Daniel Friedman
4d9517b456 Ensure LMS passes correct group_id when querying content 2014-09-10 16:43:06 -04:00
Daniel Friedman
25cbda6638 Test passing group_id in thread creation 2014-09-03 18:14:37 -04:00
Jim Abramson
5d37ea83f7 Merge pull request #4216 from edx/jsa/new-post-redesign
consolidate new post form variants into single client-side template/view
2014-06-30 14:39:46 -04:00
jsa
994ccd1110 consolidate new post form variants into single client-side template/view 2014-06-29 20:45:22 -04:00
Nimisha Asthagiri
a9213509c3 Enable Mixed Modulestore STUD-1540
Refactor get_parent_locations STUD-1663
2014-06-26 18:00:11 -04:00
Calen Pennington
cfcbdc0145 Move to OpaqueKey implementations from the external library
[LMS-2757]
2014-05-29 17:03:35 -04:00
Calen Pennington
cd746bf8e5 Make course ids and usage ids opaque to LMS and Studio [partial commit]
This commit adds the non-courseware lms/djangoapps and lms/lib.

These keys are now objects with a limited interface, and the particular
internal representation is managed by the data storage layer (the
modulestore).

For the LMS, there should be no outward-facing changes to the system.
The keys are, for now, a change to internal representation only. For
Studio, the new serialized form of the keys is used in urls, to allow
for further migration in the future.

Co-Author: Andy Armstrong <andya@edx.org>
Co-Author: Christina Roberts <christina@edx.org>
Co-Author: David Baumgold <db@edx.org>
Co-Author: Diana Huang <dkh@edx.org>
Co-Author: Don Mitchell <dmitchell@edx.org>
Co-Author: Julia Hansbrough <julia@edx.org>
Co-Author: Nimisha Asthagiri <nasthagiri@edx.org>
Co-Author: Sarina Canelake <sarina@edx.org>

[LMS-2370]
2014-05-08 12:09:23 -04:00
Jay Zoldak
c5a7911b87 Fix pylint disable pragmas that were pep8 violations 2014-03-20 10:18:40 -04:00
Usman Khalid
8b6e3b4422 Replaces print statement in django_comment_client with unicode log.debug.
LMS-2194
2014-03-19 19:36:55 +05:00
Chris Rossi
0a1ed11daa Make mako template lookups pluggable.
This code adds the ability to add Mako template lookup directories on
the fly, allowing third party add-ons to contribute their own Mako templates.
A new API function for registering Mako templates is introduced::

    from edxmako import add_lookup

    add_lookup('main', '/path/to/templates')

    # Or, specify a package to lookup using pkg_resources.  This will
    # add the 'templates' directory inside the current package:
    add_lookup('main', 'templates', package=__name__)
2014-01-31 13:55:36 -05:00
jsa
dfa4a03daa i18n: externalize strings in discussion forums templates and python code.
JIRA: FOR-398, FOR-399
2014-01-15 14:26:22 -05:00
Greg Price
5b2ff9b21a Add unit tests for non-ASCII forum content 2014-01-14 13:56:36 -05:00
David Baumgold
ce4b130113 Set default section start date to Jan 1, 2030
STUD-1072
2014-01-07 15:46:15 -05:00
David Baumgold
d15391fdfa Update factory_boy to 2.2.1 2013-12-05 15:50:49 -05:00
Calen Pennington
da26ae2529 Remove lms/lib from sys.path in favore of using it as the module lms.lib 2013-11-08 11:08:48 -05:00
Greg Price
c4cdb457de Remove label from forum posts by global staff
The motivation for this change is performance. The forums UI code gets
the list of users for each role and renders the staff label based on
those lists. The list for the staff role is expensive to compute because
there is no index on the is_staff attribute, and we cannot create one
because the User model is built into django.

Users with is_staff=True are still assigned the Moderator role upon
enrolling in a course, so this change will have no practical effect
except that a user who is granted staff privileges after enrolling in a
course will have to be made a Moderator in order for their posts to be
labeled.

Additionally, the UI did not use the list of users with the Student
role, so that list has been removed as well.
2013-11-01 14:16:55 -04:00
Greg Price
e6ecb6ecfe Improve performance of forum views
Avoid recomputing course module information for every thread, which
should dramatically improve the performance of high-percentile latency
queries.

JIRA: FOR-250
2013-10-28 13:04:52 -04:00
Greg Price
a7d769dfea Remove an unnecessary global
The _DISCUSSIONINFO global was originally used as a cache, but has since
lost that capability and is therefore just harmful. This is a precursor
to more refactoring that will improve the performance of the forums and
may itself provide some performance improvement because it separates the
computation done by two functions that each previously computed the
entirety of _DISCUSSIONINFO.
2013-10-28 12:57:51 -04:00
Greg Price
545701d520 Add forum utility code unit test coverage
This is in preparation for significant refactoring of the code in
question.
2013-10-28 11:58:43 -04:00
Greg Price
7abaecd8b7 Improve forum error handling
CommentClientError now has sane subclasses that are meaningfully
distinct, and each subclass is handled appropriately. Errors raised by
the requests library are no longer handled by turning them into
CommentClientErrors, since there is no meaningful handling we can do,
and this way we will get more visibility into why errors are occurring.
Also, HTTP status codes from the comments service indicating client
error are correctly passed through to the client.
2013-10-28 11:23:06 -04:00
Greg Price
62cc9e77bf Use HTTP header for comments service auth
Previously, authentication was done using a URL parameter, which would
appear in various logs. Now, authentication is done more appropriately
with an HTTP header. Note that this requires cs_comments_service commit
cf39aabdd160176ebf206ca19d3ee030161a0b47 or later.
2013-10-11 12:01:44 -04:00
Greg Price
b60f5f807d Make forums endpoints return better status codes
Previously, AJAX calls would return 400, and page views and attempts
to load inline discussions would return 404 if communication with the
comments service failed. Now such problems cause a 500 status code.
2013-10-10 14:20:48 -04:00
Giulio Gratta
44f4e7b10a refatoring tests and added to changelog 2013-08-23 12:59:14 -07:00
Giulio Gratta
4e77098859 added course level feature flag for forum alpha sorting as well as tests 2013-08-23 12:59:13 -07:00
Ned Batchelder
61b53713d2 Remove unused imports from lms, as detected by pylint. 2013-06-19 16:56:34 -04:00
Chris Dodge
a44e816877 remove_open_ended_panel_tab() -> remove_extra_paneltab(). Also, update new forums test factors to use refactored Models.py 2013-05-20 10:33:52 -04:00
Chris Dodge
fbbae44988 Merge branch 'master' of github.com:edx/edx-platform into feature/cdodge/autoprovision-forums-master
Conflicts:
	cms/djangoapps/contentstore/views/course.py
	lms/djangoapps/django_comment_client/base/views.py
	lms/djangoapps/django_comment_client/management/commands/show_permissions.py
	lms/djangoapps/django_comment_client/models.py
	lms/djangoapps/django_comment_client/tests/test_utils.py
	lms/envs/common.py
2013-05-20 10:22:36 -04:00
Jay Zoldak
71626f4ff6 Pep8 fixes of django_comment_client code 2013-05-16 15:57:34 -04:00
Your Name
c7e0b576d0 fix missing paren 2013-05-16 10:59:23 -04:00
Kevin Chugh
fa269d3c96 add flag thread django test 2013-05-16 10:59:23 -04:00
Jay Zoldak
7e63611478 Start adding view tests for discussion client. Note that these will not work unless you change your test.py to enable discussion forums. 2013-05-16 10:56:57 -04:00
Jay Zoldak
ed5ad46192 Revert "Revert "fix merge conflict""
This reverts commit 2df3fe9344.

Conflicts:
	common/static/coffee/src/discussion/utils.coffee
2013-05-16 10:29:33 -04:00
Chris Dodge
40e3410121 fix broken unit tests 2013-05-06 16:51:36 -04:00
Chris Dodge
a92910db20 update lms to reflect where comment models.py is now in common 2013-05-06 16:23:32 -04:00
Diana Huang
2df3fe9344 Revert "fix merge conflict"
This reverts commit acfd0d9fd6, reversing
changes made to e4194c99d8.
2013-04-26 12:40:35 -04:00
Your Name
0bcef4ddb7 fix merge conflicts 2013-04-22 12:54:33 -04:00
Your Name
7994e1b344 pep8 fixes 2013-04-22 12:53:30 -04:00
Jay Zoldak
be76f73107 Consolidate and upgrade factories 2013-04-18 15:11:10 -04:00