Commit Graph

68 Commits

Author SHA1 Message Date
John Eskew
3614eb2800 Move xmodule_django app to openedx.core.djangoapps 2016-10-06 14:50:40 -04:00
Calen Pennington
bc20a37c2b Simplify how shards are selected in CI 2016-08-03 16:23:02 -04:00
Ned Batchelder
8571ceabeb Fix many wrong-assert-type errors 2016-08-03 12:44:41 -04:00
Ned Batchelder
8b1978ba6c Fix unused-import errors 2016-08-03 12:44:41 -04:00
Saleem Latif
6277bd27e6 Remove all usages of USE_CUSTOM_THEME and THEME_NAME from python files 2016-07-27 14:53:02 +05:00
Calen Pennington
853bfe7a36 Add a TestCase mixin for enabling caches in tests
By default, disable all caching in tests, to preserve test independence.
In order to enable caching, inherit from CacheSetupMixin, and specify
which cache configuration is needed.

[EV-32]
2016-05-04 14:51:30 -04:00
Calen Pennington
39ff841d1f Don't pass arguments to setUp (for UrlResetMixin)
The TestCase API doesn't accept arguments, so passing arguments for some
TestCase subclasses makes adding new inheritance/mixins tricky. Instead,
prefer configuration via class attributes for TestCases.
2016-05-04 11:34:51 -04:00
Ben Patterson
b9558a90f1 Create a 3rd explicit shard for unit tests.
More accurately, this creates a 4th shard because the
last shard is always the default.
2016-04-28 10:09:32 -04:00
John Eskew
9cc1d4f91d Remove include_xml option. 2016-04-12 11:53:00 -04:00
Ned Batchelder
2e1238b83e Remove unused imports 2016-04-08 11:23:05 -04:00
Kevin Falcone
2d9708da03 Remove uses of using() from migrations
This hardcoded the db_alias fetched from schema_editor and forces django
to try and migrate any second database you use, rather than routing to
the default database.  In testing a build from scratch, these do not
appear needed.

Using using() prevents us from using multiple databases behind edxapp.

Additionally - add back a removed backwards migration from certificates
0003.  I have no idea why this was dropped in the 1.8 upgrade.
2016-02-01 16:57:26 -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
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
Brian Beggs
b73bf35899 fixed snapshot functionality for RestrictedCrouse embargo, select_related is now passed the proper hint. TNL-3452 2015-10-01 13:50:46 -04:00
Clinton Blackburn
e5ba2a5801 White-listed course detail API calls
XCOM-518
2015-07-27 14:06:44 -04:00
Will Daly
c2f0a68fba Merge pull request #9028 from edx/release
Merge release back to master
2015-07-23 12:48:17 -07:00
Will Daly
eefbf77edf Allow course staff to bypass embargo rules. 2015-07-23 08:26:43 -07:00
Sarina Canelake
22bbdacee9 Convert Meta classes to new-style classes 2015-07-13 17:33:26 -04:00
Sarina Canelake
b41e70f541 Remove Pylint violations deprecated-pragma, bad-option-value 2015-07-13 17:33:26 -04:00
Nickersoft
e184c78c0a XCOM-416: Embargo restrictions are now enforced during logistration 2015-06-23 14:17:43 -04:00
Ned Batchelder
78e9445aa1 Add super() calls to setUp/tearDown that are missing them
Also, I replaced a number of tearDown methods with addCleanup instead.
And also remove some unneeded patch.stopall() calls.
2015-05-14 18:14:21 -04:00
Awais
2cd265292f ECOM-1421 implementing the functionality 2015-04-16 21:46:47 +05:00
Awais
18282919b5 ECOM-1420 adding new field and migration file. 2015-04-15 12:38:43 +05:00
Clinton Blackburn
6a2b9f4521 Reorganized course_structures app
Celery requires all tasks to be in a tasks module. Also, the task has been updated to use default values if the the course structure generator encounters a block without the graded or format fields.
2015-03-10 11:12:51 -04:00
Will Daly
feed7eaada ECOM-1178: Embargo rules for continent codes.
This commit fixes a bug that could occur when GeoIP
returns a continent code ("EU" or "AN") instead of a
country code.  The previous implementation would
block users in this case since the country code
was not on the whitelist (consisting of all known
country codes).  The new implementation allows user
access by default if we don't recognize the country code.
2015-03-09 12:17:02 -04:00
Will Daly
ae8ddc8aee Deprecate old embargo implementation.
The new "country access" implementation replaces the old
implementation.  Middleware and tests have been updated
accordingly, but deprecated models are preserved
for backwards compatibility.
2015-02-23 15:48:04 -05:00
Will Daly
1624720f48 Stop hitting the database when no courses are blocked. 2015-02-20 14:17:14 -05:00
Will Daly
125f6957fc Skip country access check if feature flag is disabled 2015-02-13 08:57:37 -05:00
Will Daly
6ba6afced8 Merge pull request #6943 from edx/will/country-access-api-changes
Finish Country Access (Part 1 of 3)
2015-02-10 12:57:48 -05:00
Will Daly
98ee3a5377 Implement IP filtering in embargo middleware.
Add history table for course access rule changes.

Provide test utility for simulating restricted access.

Provide `redirect_if_blocked` method for integration with other
parts of the system (will be used for blocking enrollment).

Add info-level logging explaining when and why users are blocked.
2015-02-10 10:47:51 -05:00
Will Daly
7e746f7df0 Fix embargo migration to the new data models.
The previous version of this migration incorrectly handled
disabled configuration.  When configuration is disabled,
the embargoed country field was the empty string; calling
str.split(",") produced a list with a single empty list entry,
which is not a valid country code.
2015-02-09 14:08:35 -05:00
Will Daly
92c2fdbca1 Add new models to embargo to support country access
Add Django admin UI for configuring country access

Migrate existing embargo rules into the new tables.

ECOM-996: updated the middleware to use new models and access rules

ECOM-996: added the flag to support old and new formats

ECOM-996: added the api layer for country access settings

ECOM-996: added the api layer for country access settings

ECOM-996 implementing the white and blacklist checks.

ECOM-996 minor re-factoring in api.

ECOM-996 minor re-factoring in api.

ECOM-1025 refactoring the code according to PR feedback.

ECOM-1025 refactoring the code according to PR feedback.

ECOM-1025 deleting cache in model save and delete methods

ECOM-1025 adding basic api test cases file.

ECOM-1025 refactoring the code according to PR feedback.

ECOM-1025 refactoring the code according to PR feedback.

ECOM-1025 refactoring the code according to PR feedback. adding the test cases.

ECOM-1025 removing extra line

ECOM-1025 removing un-used function.

ECOM-1025 removing un-used function.

ECOM-1025 re-factor the code.

ECOM-1025 re-name the test file to test_middleware_access_rules.py. we already had old test_middleware.py

ECOM-1025 adding test cases for newly added models.

ECOM-1025 adding test cases and resolve conflicts.

ECOM-1025 fixing the quality and pep-8 issues.

ECOM-1025 re-factoring the code according to the PR feedback.

ECOM-1025 re-name the variable name.

ECOM-1025 removing the _check_ip_lists and its test cases. also added few missing scenarios test cases.

ECOM-1025 removing un-used line.
2015-02-09 18:28:10 +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
Will Daly
ce9c258f8b Update country access message end-points to be backwards compatible with embargo theme templates
Move default country access messages out of static_templates, so they are not served by other Django views.
2015-02-03 08:59:41 -05:00
Will Daly
82d7e25f3e Add views to the embargo app to render messages explaining why students are blocked. 2015-02-02 14:04:29 -05:00
Will Daly
a5867da9de Add new models to embargo to support country access
Add Django admin UI for configuring country access

Migrate existing embargo rules into the new tables.
2015-02-02 11:54:41 -05:00
Diana Huang
c71a183316 Update embargo copy.
ECOM-963

update copy in tests
2015-01-29 15:10:35 -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
0dad9da5e4 s/pylint: disable=W0621/pylint: disable=redefined-outer-name/ 2014-12-01 11:22:08 -05:00
stv
cf9308144d Fix PEP8: E302 expected 2 blank lines, found 1 2014-11-10 11:00:11 -08:00
Adam Palay
0a385544a3 update number of queries in embargo test 2014-09-19 10:19:23 -04:00
Renzo Lucioni
9239253614 Remove Django Waffle 2014-09-12 16:22:03 -04:00
Will Daly
512db7be99 Fix embargo middleware with tests 2014-09-09 08:50:10 -04:00
Renzo Lucioni
c3359135e7 Refrain from accessing country code if country is None 2014-09-05 10:58:18 -04:00
Renzo Lucioni
aa28fba9ad Revert "Revert "Merge pull request #4976 from edx/will/ecom-128""
This reverts commit 371dfd6187.
2014-09-05 10:51:51 -04:00
Diana Huang
371dfd6187 Revert "Merge pull request #4976 from edx/will/ecom-128"
This reverts commit a03baee25c, reversing
changes made to 12e2d442e9.
2014-09-04 16:01:28 -04:00
Will Daly
31a6566110 Embargo based on country code in the user's profile. 2014-08-27 08:51:45 -04:00
Jason Zhu
13846e074d Support ipv6 in geoinfo and Embargo 2014-08-14 16:13:35 +08:00