Commit Graph

62 Commits

Author SHA1 Message Date
Toby Lawrence
9654449302 Merge pull request #11465 from edx/perf/speed-up-courseware-tests
Switch to SharedModuleStoreTestCase in the 'courseware' app where possible.
2016-02-16 10:06:53 -05:00
Toby Lawrence
49d3a7d35d More quality fixes. 2016-02-16 07:58:33 -05:00
Toby Lawrence
ead2f0477b Quality fixes. 2016-02-15 21:18:53 -05:00
Ned Batchelder
432a40f035 Update post_cohort_management_fix to Django 1.8 2016-02-11 15:39:35 -05:00
Toby Lawrence
6a6ef0fd35 Fix some broken tests. 2016-02-08 14:13:36 -05:00
Ned Batchelder
43ac38aa87 Add autospec to all mocks 2015-12-09 09:44:22 -05:00
Eric Fischer
88a389652b CohortMembership Test Fixes
There are 3 main changes in this commit:
* CohortFactory now sets up memberships properly, so consuming tests do not
need to explicitly touch CourseUserGroup.users to add() users.
* test_get_cohort_sql_queries has been updated to 3 and 9 queries when using
and not using the cache, respectively. This is needed due to each operation
needing an extra queery to get the CourseUserGroup from the CohortMembership.
* Adding remove_user_from_cohort(), the counterpart to add_user_to_cohort().
This is also to keep tests from touching the users field directly, and keep
CohortMembership data in sync.
2015-12-02 15:03:52 -05:00
Eric Fischer
731d85f771 CohortMembership Transaction Fixes
An issue arose recently due to ATOMIC_REQUESTS being turned on by default. It
turns out that CohortMemberships had been somewhat relying on the old default
transaction handling in order to keep CohortMemberships and the underlying
CourseUserGroup.users values in-sync.

To fix this, I've made all updates to Cohortmemberships go through an
outer_atomic(read_committed=True) block. This, is conjunction with the already
present select_for_update(), will no longer allow 2 simultaneous requests to
modify objects in memory without sharing them. Only one process will be
touching a given CohortMembership at any given time, and all changes will be
immediately comitted to the database, where the other process will see them.

I've also included some changes to get_cohort(), add_user_to_cohort(), and
remove_user_from_cohort() in order to properly make use of the new
CohortMembership system.
2015-12-02 15:03:28 -05:00
Ned Batchelder
f5d0f3ff55 Remove useless pylint suppressions 2015-11-22 07:41:19 -05:00
Usman Khalid
6cb62f2697 Rebase upgrade Django to v1.8.5
Please note that this is a squshed commit and the work of:
Symbolist, macdiesel, nedbat, doctoryes, muzaffaryousaf and muhammad-ammar
2015-11-10 15:00:19 -05:00
Eric Fischer
3609cc7a99 Post-migration management command
On devops recommendation, now handling the potential for an 'inconsistency
window' via a management command instead of a hacky "re-run the data migration"
bash script.
2015-11-03 10:30:43 -05:00
Eric Fischer
dbbc64ff88 CohortMembership Race Condition Test
By using the before_after library, we can force a race condition to reliably
occur in the CohortMembership.save() method. This unit test will do just that,
and ensure that our race-condition-handling code functions as it should.
2015-10-30 11:07:25 -04:00
Eric Fischer
08ed3b547f CohortMemberships Unit Test Updates
Updating previously-existing unit tests to function with the new
CohortMembership model.
2015-10-30 11:07:25 -04:00
Eric Fischer
83163e58f8 CohortMemberships Code Changes
The code changes needed to get CohortMembership functioning properly.

The key of this change is twofold: first, CohortMemberships are unique
per-user, per-course. This is enforced at the database level. Secondly,
the updates are done using a select_for_update, which ensures atomicity.
2015-10-30 11:07:25 -04:00
Eric Fischer
56d49e7390 CohortMemberships Migrations
These are the migrations needed for CohortMembership to function.
0005 establishes the table, 0006 will be used to move existing data
into the table as needed.

Per product guidance, we can just arbitrarily reassign problem users.
Implementing that decision, as well as the remainder of the data migration.

Also including a short script to re-run the 0006 migration after code changes
are live, to prevent a potential issue where the database become out-of-sync.
2015-10-30 11:07:25 -04:00
Ned Batchelder
322ca34b20 Remove pylint pragmas from "class Meta"
Also remove useless docstrings where they were added to keep pylint
quiet.
2015-10-21 07:37:00 -04:00
Matt Drayer
1eab25f292 mattdrayer/increment-edx-lint: Bump to v0.2.9 and address pylint/pep8 violations
* Fix paver violations to stablize edx-lint update
* Parens, Line2Long
* Fix missing docstrings
* Fix PEP8 issues
* Address PR feedback (thanks @nedbat!)
2015-10-19 10:11:59 -04:00
muhammad-ammar
6a5ce5d544 Upgrade factory_boy
TNL-3179
2015-09-18 18:02:38 +05:00
zubair-arbi
ec28a75f14 In-course reverification access control
* Automatically create user partitions on course publish for each ICRV checkpoint.
* Disable partitions for ICRV checkpoints that have been deleted.
* Skip partitions that have been disabled when checking access.
* Add verification access control UI to visibility settings.
* Add verification access control UI to sequential and vertical settings.
* Add partition scheme for verification partition groups.
* Cache information used by verification partition scheme and invalidate the cache on update.
* Add location parameter to UserPartition so the partition scheme can find the associated checkpoint.
* Refactor GroupConfiguration to allow multiple user partitions.
* Add special messaging to ICRV for students in the honor track.

Authors: Zubair Arbi, Awais Qureshi, Aamir Khan, Will Daly
2015-08-20 08:43:55 -07:00
Ned Batchelder
f54fe787c6 Remove needless 'disable=no-member' pragmas 2015-08-03 17:47:44 -04:00
Ben McMorran
4a78271851 Move is_commentable_cohorted to django_comment_client 2015-07-30 20:59:34 +00:00
Braden MacDonald
0defc55b84 Allow previewing cohorted content when masquerading 2015-07-22 00:54:15 -07:00
Sarina Canelake
22bbdacee9 Convert Meta classes to new-style classes 2015-07-13 17:33:26 -04:00
Sarina Canelake
ba8fd1c21d Eliminate instances of unused-import Pylint violation 2015-07-13 17:33:25 -04:00
Kevin Luo
718c21cfc8 Improve cohort test
Remove SQLite version dependent error string check
2015-06-17 16:06:10 -07:00
Sarina Canelake
e53b9c83d9 Use Django 1.4 @ensure_csrf_cookie method PLAT-664 2015-06-06 08:48:36 -04:00
Diana Huang
dae137feaa Convert all tabs to the new plugin framework. 2015-06-02 15:05:16 -04:00
Greg Price
7ce579c274 Add group fields to thread list endpoint 2015-05-11 15:59:35 -04:00
Ned Batchelder
777be12ada Add missing __init__.py files 2015-04-30 07:43:08 -04:00
Christina Roberts
3f07660d27 Merge pull request #7454 from edx/andya/user-api-transaction-handling
Clean up transactional behavior in User API
2015-03-25 15:08:21 -04:00
Andy Armstrong
a9dce7c331 Clean up transactional behavior in User API 2015-03-25 13:44:03 -04:00
Sarina Canelake
c6ab15c64c Merge pull request #7352 from edx/sarina/pep8-quality-report
Improve pep8 reporting
2015-03-23 21:10:58 -04:00
Sarina Canelake
e77211b713 Run pep8 on all files, and fix uncovered errors 2015-03-23 15:50:29 -04:00
Ned Batchelder
a84735057d Move common/lib/*.py to openedx/core/lib
This makes these files importable, and puts them into the new best guess
as to where files should live.
2015-03-23 12:40:24 -04:00
Usman Khalid
c50f828187 Fixes after rebase. 2015-03-23 19:03:31 +05:00
muzaffaryousaf
e6c75529c0 Cohort discussion topics via UI in instructor dashboard.
TNL-1256
2015-03-23 14:28:22 +05:00
Usman Khalid
eee6250fb2 Use RequestCache to cache cohorts information.
TNL-1258
2015-03-23 09:57:16 +05:00
Usman Khalid
a9e0082c7c Cache cohort info during requests to reduce SQL queries.
TNL-1258
2015-03-23 09:44:23 +05:00
Usman Khalid
d59be9949e Use cohort settings from CourseCohortSettings.
TNL-1258
2015-03-23 09:43:00 +05:00
Muhammad Ammar
70efd28483 Changes after Andy's Review 2015-03-23 09:21:21 +05:00
Muhammad Ammar
3ce494f5c5 Enable/disable cohorts from the instructor dashboard and move cohorts management to its own tab
TNL-1268
2015-03-23 09:21:15 +05:00
muhammad-ammar
0ebd8c29b0 Allow Instructor To Rename Cohorts And Set Cohort Assignment Method
TNL-181
2015-03-23 09:10:59 +05:00
Ned Batchelder
7d799e34f3 Remove unused imports 2015-03-17 07:10:31 -04:00
zubair-arbi
969bfa5916 use 'commit_on_success' transaction decorator to avoid registering users in multiple cohort groups of a particular course
TNL-1331
2015-03-05 15:19:57 +05:00
stv
c4cdd65744 Fix PEP8: E303 too many blank lines 2015-02-27 10:04:52 -08:00
Daniel Friedman
322f6d1be2 Ignore staff member's cohort when masquerade is on
TNL-1269
2015-02-11 09:38:32 -05:00
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
Daniel Friedman
fff84928fa Create and edit content groups in Studio 2015-01-15 10:37:24 -05:00
Andy Armstrong
ac58ebf7da Rename 'cohort groups' to just 'cohorts' 2015-01-15 10:33:48 -05:00