Commit Graph

32 Commits

Author SHA1 Message Date
Aarif
8cc86d3aab BOM-1141
Updating the django-rate-limit requirement.
updated the django-ratelimit to use unreleased version that supports Django 2.2
2020-01-26 12:45:37 +05:00
Feanil Patel
6e3fe00fff Fix all E303 pep8 errors. 2019-12-30 12:25:38 -05:00
Feanil Patel
9cf2f9f298 Run 2to3 -f future . -w
This will remove imports from __future__ that are no longer needed.

https://docs.python.org/3.5/library/2to3.html#2to3fixer-future
2019-12-30 10:35:30 -05:00
Ned Batchelder
efba6e45e8 Finally import courseware properly everywhere to get rid of a warning 2019-09-26 09:40:15 -04:00
Stu Young
6dc70a6758 incr-310 (#20615)
* run python modernize

* run isort

* Add oauth2_handler module docstring.
2019-05-16 14:42:22 -04:00
Michael Youngstrom
3221c2b91f Remove lms pytest shards 2019-02-12 11:03:46 -05:00
Jeremy Bowman
68902a2f3f TE-2689 Remove useless pylint suppressions part 3 2018-08-16 09:57:01 -04:00
Stuart Young
1fd2167144 rebalance python unittests onto new shards 2018-05-03 11:16:05 -04:00
Ahsan Ulhaq
1b2fdc058d Rate limited /oauth2/access_token/
There has been some reports about attack on /oauth2/access_token/.
This cause LMS to be down. This is being resolved by rate limiting the
endpoint.
LEARNER-3393
2018-01-08 16:58:16 +05:00
Andy Armstrong
79acb5c5be Reorder LMS imports using isort 2017-06-11 21:48:06 -04:00
David Ormsbee
2051c90924 Test Speedup: Isolate Modulestore Signals
There are a number of Django Signals that are on the modulestore's
SignalHandler class, such as SignalHandler.course_published. These
signals can trigger very expensive processes to occur, such as course
overview or block structures generation. Most of the time, the test
author doesn't care about these side-effects.

This commit does a few things:

* Converts the signals on SignalHandler to be instances of a new
  SwitchedSignal class, that allows signal sending to be disabled.

* Creates a SignalIsolationMixin helper similar in spirit to the
  CacheIsolationMixin, and adds it to the ModuleStoreIsolationMixin
  (and thus to ModuleStoreTestCase and SharedModuleStoreTestCase).

* Converts our various tests to use this new mechanism. In some cases,
  this means adjusting query counts downwards because they no longer
  have to account for publishing listener actions.

Modulestore generated signals are now muted by default during test runs.
Calls to send() them will result in no-ops. You can choose to enable
specific signals for a given subclass of ModuleStoreTestCase or
SharedModuleStoreTestCase by specifying an ENABLED_SIGNALS class
attribute, like the following example:

    from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase

    class MyPublishTestCase(ModuleStoreTestCase):
        ENABLED_SIGNALS = ['course_published', 'pre_publish']

You should take great care when disabling signals outside of a
ModuleStoreTestCase or SharedModuleStoreTestCase, since they can leak
out into other tests. Be sure to always clean up, and never disable
signals outside of testing. Because signals are essentially process
globals, it can have a lot of unpleasant side-effects if we start
mucking around with them during live requests.

Overall, this change has cut the total test execution time for
edx-platform by a bit over a third, though we still spend a lot in
pre-test setup during our test builds.

[PERF-413]
2017-02-23 10:31:16 -05:00
Dennis Jen
080f2b90db Added tracking claim to profile scope in oauth handler. 2017-01-26 09:49:47 -05:00
Andy Armstrong
4d4097e13c Move dark_lang and lang_pref apps to openedx/core 2016-10-13 11:56:24 -04:00
J. Cliff Dyer
88fef8b2a4 Use renamed edx_oauth2_provider throughout.
MA-1998 Install and configure django_oauth_toolkit to coexist with
existing oauth libraries.
2016-03-30 14:21:17 +00:00
Ned Batchelder
0872732cf0 Fix pylint C7630 (literal used as attribute) violations
There's no need to use a string literal in setattr, delattr, or the
two-argument form of getattr.
2015-11-23 15:32:54 -05:00
Dennis Jen
844edac443 Optimize OpenID Course Claims for users.
- Course overviews will cache courses upon publish.
- Added management command to warm up cache.
- OAuth2 handler returns courses via course overviews.
2015-09-17 11:29:28 -04:00
Dennis Jen
72e6b8aaeb Revert "Optimize OpenID Course Claims for non-global-staff users."
This reverts commit f0d1772da3.
2015-08-11 17:06:22 -04:00
Dennis Jen
f0d1772da3 Optimize OpenID Course Claims for non-global-staff users. 2015-08-03 16:48:28 -04:00
Andy Armstrong
6976a33a85 Add the preferences endpoint to the User API
TNL-1493

See https://openedx.atlassian.net/wiki/display/TNL/User+API for details
2015-03-16 23:34:35 -04:00
Clinton Blackburn
2945b923d3 Updated _get_courses_with_access_type
- Return all courses for global staff without iteration
- Filter all courses on block type
2015-02-06 20:19:42 -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
Andy Armstrong
356b2335e9 Add base support for cohorted group configurations
TNL-649
2014-12-05 09:52:26 -05:00
Clinton Blackburn
46d5593201 Merge pull request #6105 from edx/clintonb/oidc-administrator-claim
Added OAuth2 Permissions Scope Handler
2014-12-02 11:11:15 -05:00
Clinton Blackburn
5a561f81d4 Added OAuth2 Permissions Scope Handler
This scope offers a simple claim, administrator, that is true iff the user is a superuser.
2014-12-02 11:08: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
Carlos Andrés Rocha
1b858e5497 Merge pull request #5749 from rocha/cache-oauth2-handler-course-values
Cache user course privileges during OpenID Connect authorization.
2014-11-07 14:38:09 -05:00
Carlos Andrés Rocha
fac73e88d0 Cache user course privileges during OpenID Connect authorization. 2014-11-06 13:46:32 -05:00
muhammad-ammar
fcaa783e43 Unit Test Improvements
TE-489
2014-10-31 11:55:13 +00:00
Carlos Andrés Rocha
9cd26e551a List all courses during OAut2/OpenID Connect
Previously, only courses respective to the branded instance were returned.

AN-3610
2014-10-03 14:15:41 -04:00
Carlos Andrés Rocha
5500cc6816 Use default locale to OpenID profile claims.
If the user has not selected a default locale, then return the default one.
2014-09-22 15:19:40 -04:00
Carlos Andrés Rocha
19f95f0053 Return OpenID Connect user name from user profile. 2014-09-22 11:34:10 -04:00
Carlos Andrés Rocha
8857509b2d Add edX OAuth2 provider with OpenID Connect support 2014-09-17 11:36:06 -04:00