Commit Graph

64 Commits

Author SHA1 Message Date
usamasadiq
84bb9faa3f refactor: ran pyupgrade on lms/djangoapps/certificates 2021-02-25 19:58:39 +05:00
usamasadiq
96f0915b0f Fixed new pylint warnings.
use generator in any/all()
disable not-callable warnings
disable no-member warnings
Suppressed smaller pylint warnings
Pin edx-proctoring==3.5.0
2021-02-22 16:36:53 +05:00
Aarif
a332aac1f6 replaced unittest assertions pytest assertions (#26541) 2021-02-19 12:27:11 +05:00
Christie Rice
7db147e06a Fix lint-amnesty warnings (#26412) 2021-02-09 10:20:46 -05:00
Christie Rice
367d2a07c9 Fix lint-amnesty warnings (#26411) 2021-02-08 10:49:32 -05:00
Jawayria
92a13c55c3 Applied pylint-amnesty to certificates 2021-02-02 19:23:48 +05:00
Manjinder Singh
2723e0e2bd [ARCHBOM-1645] Modifying anonymous_id_for_user() to handly SECRET_KEY rotation (#26162)
These changes were initially made to make it easier to do SECRET_KEY rotations.  Along the way, we found it made sense to refractor the code as well.

Changes made:
- changed get_to_create to create because now the code should only get to this block when a write is necessary
- added a lookup for anonymous_user_id. This is to return an existing anonymous_user_id rather than calculating. This will mitigate the results of SECRET_KEY rotation.
- Added monitoring to help us make better decisions: should we not sue SECRET_KEY, performance considerations...
- put old function behind toggle in case something goes wrong in production with new code
- refractoring function structure for better understanding
2021-01-27 07:23:19 -05:00
Christie Rice
32e0eb2edc MICROBA-921 Standardize imports within the certificates app for consistency (#26131) 2021-01-25 15:29:42 -05:00
Kyle McCormick
151bd13666 Use full names for common.djangoapps imports; warn when using old style (#25477)
* Generate common/djangoapps import shims for LMS
* Generate common/djangoapps import shims for Studio
* Stop appending project root to sys.path
* Stop appending common/djangoapps to sys.path
* Import from common.djangoapps.course_action_state instead of course_action_state
* Import from common.djangoapps.course_modes instead of course_modes
* Import from common.djangoapps.database_fixups instead of database_fixups
* Import from common.djangoapps.edxmako instead of edxmako
* Import from common.djangoapps.entitlements instead of entitlements
* Import from common.djangoapps.pipline_mako instead of pipeline_mako
* Import from common.djangoapps.static_replace instead of static_replace
* Import from common.djangoapps.student instead of student
* Import from common.djangoapps.terrain instead of terrain
* Import from common.djangoapps.third_party_auth instead of third_party_auth
* Import from common.djangoapps.track instead of track
* Import from common.djangoapps.util instead of util
* Import from common.djangoapps.xblock_django instead of xblock_django
* Add empty common/djangoapps/__init__.py to fix pytest collection
* Fix pylint formatting violations
* Exclude import_shims/ directory tree from linting
2020-11-10 07:02:01 -05:00
Saleem Latif
364940b04f Upgraded edx-enterprise verision to 3.9.9 2020-10-29 17:57:08 +05:00
Saleem Latif
43d0a67fa1 Request for field to specify locale in Django enterprise accounts 2020-10-20 17:56:22 +05:00
uzairr
d0f7120198 Restrict cert api to staff and self user 2020-06-03 18:12:30 +05:00
uzairr
39b4a3f4a7 Restrict api to staff users 2020-05-19 17:22:50 +05:00
Aarif
6ee2089077 fixed warnings for wrong-import-order 2020-04-08 23:43:06 +05:00
Waheed Ahmed
02b900cf64 Remove unnecessary check.
If `courseoverview.display_name` is set we don't get it from block
and we can remove this unnecessary check.
2020-03-20 13:50:51 +05:00
Robert Raposa
ebf99fd857 move override 2020-02-27 10:29:03 -05:00
Robert Raposa
c291e4a521 fix tests and requirements
try to fix github
2020-02-27 09:56:31 -05:00
Robert Raposa
e2cc7fa348 fix failing tests 2020-02-27 09:00:01 -05:00
Robert Raposa
a4716c75cb fix tests 2020-02-27 08:58:45 -05:00
Robert Raposa
84686e81c3 BOM-1324: remove oauth2.enforce_jwt_scopes toggle
The oauth2.enforce_jwt_scopes waffle switch was added temporarily for
the rollout of jwt scopes. This removes the toggle and replacing code
with the equivalent of `oauth2.enforce_jwt_scopes` as True.
2020-02-27 08:58:45 -05:00
Waheed Ahmed
9bd85dc929 Fix certificates API for old deleted XML course certificates.
Certificates API is retuning 500 error for old XML courses in which learners
have a valid certificate.

PROD-1247
2020-02-27 13:13:13 +05:00
Manjinder Singh
d7bd80a100 Renamed OAuth2Authentication to BearerAuthentication (#23128)
* Renamed OAuth2Authentication to BearerAuthentication
* Added back OAuth2Authentication name
-there are libraries such as edx-enterprise that still import OAuth2Authentication.  The OAuth2Authentication class should be fully removed when everything is importing BearerAuthentication correctly
2020-02-18 13:29:29 -05:00
Manjinder Singh
cce8cdd661 Replacing OAuth2Auth (#23067)
- Removing deprecated auth classes
- Replacing OAuth2AuthenticationAllowInactiveUserDeprecated with OAuth2AuthenticationAllowInactiveUser
- the old class was a child class of a deprecated class that we are removing and replacing.
2020-02-11 10:38:13 -05:00
Alan Zarembok
70955119f1 PROD-1236: Change URL returned for generated certificates to use UUID, for consistency across api calls. 2020-02-07 10:19:55 -05:00
Manjinder Singh
cea795b02e Added new auth class (#23018)
* Added new auth class

- Created new class called OAuth2AuthenticationAllowInactiveUser, which replaces old class with same name
- Renames previous  OAuth2AuthenticationAllowInactiveUser to  OAuth2AuthenticationAllowInactiveUserDeprecated
- Replaced all imports of  OAuth2AuthenticationAllowInactiveUser to call deprecated class instead
- testing new class in discussion(added flag based on django setting)
2020-02-06 10:37:27 -05:00
Waheed Ahmed
54b64e70f4 Restrict certificate endpoint to return certificates.
Do not return certificates if there is no active certificate
configuration.

PROD-1200
2020-01-29 22:29:55 +05:00
Kyle McCormick
28c0433352 Reinstate "Remove CourseOverview.get_from_id[s]_if_exists (#22918)"
This reverts commit cdb0619846,
which itself reverted 3ca006214e.

The original commit (3ca006) was reverted because it was suspected
that it was causing unexpectedly-increased memcached usage and
500s in the Gradebook API. It is not clear whether that is actually
the case. We are optimistically reinstating 3ca006 and will monitor
production to see if there is an adverse effect.

MST-105
2020-01-27 11:17:06 -05:00
Kyle McCormick
cdb0619846 Revert "Remove CourseOverview.get_from_id[s]_if_exists (#22918)" (#22926)
This reverts commit 3ca006214e.
2020-01-23 13:52:11 -05:00
Kyle McCormick
3ca006214e Remove CourseOverview.get_from_id[s]_if_exists (#22918)
The functions `CourseOverview.get_from_id_if_exists`
and `CourseOverview.get_from_ids if exists` are bug-
prone, in that they do not go to the modulestore
when a CourseOverview is out-of-date or uncached.
The docstrings spell this out, but callers seem
not to understand the implications.

So, in this commit, we:
* Remove both functions
* Add `CourseOverview.get_from_ids` for almost-as-fast
  yet safer bulk-fetching of overviews
* Update call sites to use `course_exists` or `get_from_ids`
  in place of the old functions.
* Add tests for @verify_course_exists.
This PR should specifically fix an issue where
the program_enrollments API was breaking when the CourseOverview
version was bumped.

CR-1708
2020-01-23 09:41:55 -05:00
Ned Batchelder
079d17b899 Remove code that is now in edx_api_doc_tools 2020-01-21 11:15:41 -05:00
aarif
79bf089406 updated the django-waffle to support django 2.2
made changes to test with previous version of django-waffle

updated the query count to test

testing with version 0.13

testing with version 0.14

testing with version 0.15

added version 0.14

updated the django-waffle version to use 0.18

updated the django-waffle version to use 0.16

updated the query counts to pass tests

ran make upgrade

updated the django-waffle to support django 2.2

made changes to test with previous version of django-waffle

updated the query count to test

testing with version 0.13

testing with version 0.14

testing with version 0.15

added version 0.14

updated the django-waffle version to use 0.18

updated the django-waffle version to use 0.16

updated the query counts to pass tests

removed the pdb statements

ran make upgrade
2020-01-08 14:11:42 +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
Régis Behmo
ae216c8584 Rename API decorators to "apidocs" to be provider-agnostic
The API documentation decorators do not have to leak which solution we
use to generate the docs. Here, and as discussed in PR #21820, we rename
the `openapi` module to `apidocs`, and we make sure that this module
includes all the right functions to document API Views without referring
to Open API.
2019-10-14 08:14:18 +02:00
Régis Behmo
1d9a5ab4e7 Rename swagger_auto_schema decorator 2019-10-14 08:14:08 +02:00
Régis Behmo
dac393e9e7 Auto-document API endpoints using view function docstring
The `swagger_auto_schema` view function decorator allows us to
auto-document API endpoints. All swagger arguments are passed as kwargs
to the decorator, but this feels a bit unnatural: we would like to use
the function documentation as the endpoint summary and description. We
introduce this feature here by reading the `__doc_`_attribute of the
view function.
2019-10-14 08:14:08 +02:00
Ned Batchelder
f7cd63f784 Convert bookmarks and certificates API docs to yasg format 2019-09-17 16:54:27 -04:00
Amit
2c8c3b8a74 INCR-469: Updates on Python 3.x, disable: import-error and fix line over length (#20962) 2019-07-08 13:57:26 -04:00
Douglas Hall
04b2c12893 Include GeneratedCertificate modified date in certificates API response. 2019-03-22 12:39:18 -04:00
Douglas Hall
092d1bdf01 Check GeneratedCertificate.download_url before using HTML cert URL. 2019-03-11 14:18:16 -04:00
Douglas Hall
c0cb493a41 Filter certificate list API based on user profile visibility preference. 2019-03-08 10:55:45 -05:00
Douglas Hall
8373298149 Add list endpoint to course certificate API. 2019-03-01 14:48:00 -05:00
Michael Youngstrom
3221c2b91f Remove lms pytest shards 2019-02-12 11:03:46 -05:00
Matthew Piatetsky
6e81c84d8b fix unicode strings in lms/ part 1 2019-02-05 15:15:02 -05:00
Ned Batchelder
3353e7425e Remove unused imports 2018-11-03 16:07:05 -04:00
Robert Raposa
fbc59231fc Update edx-drf-extensions to 2.0.0.
Note: this version update is backward incompatible.

ARCH-255
2018-10-17 01:00:34 -04:00
Nimisha Asthagiri
f844e765fb Create shared test mixin for testing OAuth Scopes and various Auth.
ARCH-168
2018-10-13 16:21:01 -04:00
Nimisha Asthagiri
31a1ad4a09 Merge pull request #18999 from edx/arch/refactor-jwt-builder
JWT Cookies
2018-10-01 13:45:15 -04:00
Nimisha Asthagiri
02ba5fb0e8 Login service support for JWT Cookies 2018-10-01 13:08:40 -04:00
Ahsan Ulhaq
ee7555e85f update usage of SessionAuthenticationAllowInactiveUser
LEARNER-6469
2018-10-01 17:52:52 +05:00
Nimisha Asthagiri
3a45bab57c Enable OAuth Scopes for Certificates API 2018-06-28 18:37:52 -04:00