diff --git a/lms/djangoapps/program_enrollments/api/api.py b/lms/djangoapps/program_enrollments/api/api.py new file mode 100644 index 0000000000..b05c2ca275 --- /dev/null +++ b/lms/djangoapps/program_enrollments/api/api.py @@ -0,0 +1,53 @@ +# -*- coding: utf-8 -*- +""" +ProgramEnrollment internal api. +""" +from __future__ import absolute_import, unicode_literals + +from lms.djangoapps.program_enrollments.rest_api.v1.utils import ( + get_due_dates as get_due_dates_util, + get_course_run_url as get_course_run_url_util, + get_emails_enabled as get_emails_enabled_util, +) + + +def get_due_dates(request, course_key, user): + """ + Get due date information for a user for blocks in a course. + Arguments: + request: the request object + course_key (CourseKey): the CourseKey for the course + user: the user object for which we want due date information + Returns: + due_dates (list): a list of dictionaries containing due date information + keys: + name: the display name of the block + url: the deep link to the block + date: the due date for the block + """ + return get_due_dates_util(request, course_key, user) + + +def get_course_run_url(request, course_id): + """ + Get the URL to a course run. + Arguments: + request: the request object + course_id (string): the course id of the course + Returns: + (string): the URL to the course run associated with course_id + """ + return get_course_run_url_util(request, course_id) + + +def get_emails_enabled(user, course_id): + """ + Get whether or not emails are enabled in the context of a course. + Arguments: + user: the user object for which we want to check whether emails are enabled + course_id (string): the course id of the course + Returns: + (bool): True if emails are enabled for the course associated with course_id for the user; + False otherwise + """ + return get_emails_enabled_util(user, course_id) diff --git a/openedx/core/djangoapps/util/tests/test_signals.py b/openedx/core/djangoapps/util/tests/test_signals.py index 0a613cd4da..25662a6412 100644 --- a/openedx/core/djangoapps/util/tests/test_signals.py +++ b/openedx/core/djangoapps/util/tests/test_signals.py @@ -2,12 +2,14 @@ from __future__ import absolute_import from unittest import TestCase +from pytest import mark from celery.task import task from django.test.utils import override_settings from edx_django_utils.cache import RequestCache +@mark.django_db class TestClearRequestCache(TestCase): """ Tests _clear_request_cache is called after celery task is run. diff --git a/requirements/edx/base.txt b/requirements/edx/base.txt index 7a4bc71e79..e3cccc2a40 100644 --- a/requirements/edx/base.txt +++ b/requirements/edx/base.txt @@ -84,10 +84,10 @@ django-simple-history==2.7.3 django-splash==0.2.2 django-statici18n==1.4.0 django-storages==1.4.1 -django-user-tasks==0.1.9 +django-user-tasks==0.2.0 django-waffle==0.12.0 django-webpack-loader==0.6.0 -django==1.11.23 +django==1.11.24 djangorestframework-jwt==1.11.0 git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1 djangorestframework-xml==1.4.0 # via edx-enterprise @@ -97,7 +97,7 @@ docutils==0.15.2 # via botocore drf-yasg==1.16 edx-ace==0.1.10 edx-analytics-data-api-client==0.15.3 -edx-bulk-grades==0.5.9 +edx-bulk-grades==0.5.10 edx-ccx-keys==0.2.2 edx-celeryutils==0.3.0 edx-completion==2.0.0 @@ -106,7 +106,7 @@ edx-django-release-util==0.3.1 edx-django-sites-extensions==2.3.1 edx-django-utils==2.0.0 edx-drf-extensions==2.4.0 -edx-enterprise==1.9.10 +edx-enterprise==1.9.12 edx-i18n-tools==0.4.8 edx-milestones==0.2.3 edx-oauth2-provider==1.3.0 @@ -175,7 +175,7 @@ git+https://github.com/edx/edx-ora2.git@2.2.7#egg=ora2==2.2.7 path.py==8.2.1 pathtools==0.1.2 paver==1.3.4 -pbr==5.4.2 +pbr==5.4.3 pdfminer.six==20181108 piexif==1.0.2 pillow==6.1.0 @@ -220,7 +220,7 @@ rules==2.1 s3transfer==0.1.13 # via boto3 sailthru-client==2.2.3 scipy==1.2.1 -semantic-version==2.8.1 # via edx-drf-extensions +semantic-version==2.8.2 # via edx-drf-extensions shapely==1.6.4.post2 shortuuid==0.5.0 # via edx-django-oauth2-provider simplejson==3.16.0 # via mailsnake, sailthru-client @@ -234,7 +234,7 @@ sortedcontainers==2.1.0 soupsieve==1.9.3 # via beautifulsoup4 sqlparse==0.3.0 staff-graded-xblock==0.5 -stevedore==1.30.1 +stevedore==1.31.0 super-csv==0.9.1 sympy==1.4 testfixtures==6.10.0 # via edx-enterprise diff --git a/requirements/edx/development.txt b/requirements/edx/development.txt index b077f4ff7f..783c1fe9ee 100644 --- a/requirements/edx/development.txt +++ b/requirements/edx/development.txt @@ -107,10 +107,10 @@ django-simple-history==2.7.3 django-splash==0.2.2 django-statici18n==1.4.0 django-storages==1.4.1 -django-user-tasks==0.1.9 +django-user-tasks==0.2.0 django-waffle==0.12.0 django-webpack-loader==0.6.0 -django==1.11.23 +django==1.11.24 djangorestframework-jwt==1.11.0 git+https://github.com/edx/django-rest-framework-oauth.git@0a43e8525f1e3048efe4bc70c03de308a277197c#egg=djangorestframework-oauth==1.1.1 djangorestframework-xml==1.4.0 @@ -121,7 +121,7 @@ docutils==0.15.2 drf-yasg==1.16 edx-ace==0.1.10 edx-analytics-data-api-client==0.15.3 -edx-bulk-grades==0.5.9 +edx-bulk-grades==0.5.10 edx-ccx-keys==0.2.2 edx-celeryutils==0.3.0 edx-completion==2.0.0 @@ -130,7 +130,7 @@ edx-django-release-util==0.3.1 edx-django-sites-extensions==2.3.1 edx-django-utils==2.0.0 edx-drf-extensions==2.4.0 -edx-enterprise==1.9.10 +edx-enterprise==1.9.12 edx-i18n-tools==0.4.8 edx-lint==1.3.0 edx-milestones==0.2.3 @@ -176,7 +176,7 @@ httplib2==0.13.1 httpretty==0.9.6 idna==2.8 imagesize==1.1.0 # via sphinx -importlib-metadata==0.19 +importlib-metadata==0.20 inflect==2.1.0 inflection==0.3.1 ipaddress==1.0.22 @@ -227,7 +227,7 @@ path.py==8.2.1 pathlib2==2.3.4 pathtools==0.1.2 paver==1.3.4 -pbr==5.4.2 +pbr==5.4.3 pdfminer.six==20181108 piexif==1.0.2 pillow==6.1.0 @@ -296,7 +296,7 @@ sailthru-client==2.2.3 scandir==1.10.0 scipy==1.2.1 selenium==3.141.0 -semantic-version==2.8.1 +semantic-version==2.8.2 shapely==1.6.4.post2 shortuuid==0.5.0 simplejson==3.16.0 @@ -304,7 +304,7 @@ singledispatch==3.4.0.3 six==1.12.0 slumber==0.7.1 snakefood==1.4 -snowballstemmer==1.9.0 # via sphinx +snowballstemmer==1.9.1 # via sphinx social-auth-app-django==2.1.0 social-auth-core==1.7.0 sorl-thumbnail==12.3 @@ -314,7 +314,7 @@ sphinx==1.8.5 sphinxcontrib-websupport==1.1.2 # via sphinx sqlparse==0.3.0 staff-graded-xblock==0.5 -stevedore==1.30.1 +stevedore==1.31.0 super-csv==0.9.1 sympy==1.4 testfixtures==6.10.0 @@ -322,7 +322,7 @@ text-unidecode==1.2 tincan==0.0.5 toml==0.10.0 tox-battery==0.5.1 -tox==3.13.2 +tox==3.14.0 transifex-client==0.13.4 typing==3.7.4.1 unicodecsv==0.14.1 @@ -330,7 +330,7 @@ unidiff==0.5.5 uritemplate==3.0.0 urllib3==1.25.3 user-util==0.1.5 -virtualenv==16.7.4 +virtualenv==16.7.5 voluptuous==0.11.7 vulture==1.0 watchdog==0.9.0 @@ -339,7 +339,7 @@ web-fragments==0.3.0 webencodings==0.5.1 webob==1.8.5 websocket-client==0.56.0 -werkzeug==0.15.5 +werkzeug==0.15.6 wrapt==1.10.5 git+https://github.com/edx-solutions/xblock-drag-and-drop-v2@v2.2.4#egg=xblock-drag-and-drop-v2==2.2.4 git+https://github.com/open-craft/xblock-poll@add89e14558c30f3c8dc7431e5cd6536fff6d941#egg=xblock-poll==1.5.1 diff --git a/requirements/edx/django.txt b/requirements/edx/django.txt index 6e89f86428..25d563b64e 100644 --- a/requirements/edx/django.txt +++ b/requirements/edx/django.txt @@ -1 +1 @@ -django==1.11.23 +django==1.11.24 diff --git a/requirements/edx/paver.txt b/requirements/edx/paver.txt index ca3db716db..2472859bcc 100644 --- a/requirements/edx/paver.txt +++ b/requirements/edx/paver.txt @@ -16,14 +16,14 @@ mock==1.0.1 path.py==8.2.1 pathtools==0.1.2 # via watchdog paver==1.3.4 -pbr==5.4.2 # via stevedore +pbr==5.4.3 # via stevedore psutil==1.2.1 pymongo==2.9.1 python-memcached==1.59 pyyaml==5.1.2 # via watchdog requests==2.22.0 six==1.12.0 # via edx-opaque-keys, libsass, paver, python-memcached, stevedore -stevedore==1.30.1 +stevedore==1.31.0 urllib3==1.25.3 # via requests watchdog==0.9.0 wrapt==1.10.5 diff --git a/requirements/edx/testing.txt b/requirements/edx/testing.txt index 4c816c06a3..a4d4b359a6 100644 --- a/requirements/edx/testing.txt +++ b/requirements/edx/testing.txt @@ -104,7 +104,7 @@ django-simple-history==2.7.3 django-splash==0.2.2 django-statici18n==1.4.0 django-storages==1.4.1 -django-user-tasks==0.1.9 +django-user-tasks==0.2.0 django-waffle==0.12.0 django-webpack-loader==0.6.0 djangorestframework-jwt==1.11.0 @@ -117,7 +117,7 @@ docutils==0.15.2 drf-yasg==1.16 edx-ace==0.1.10 edx-analytics-data-api-client==0.15.3 -edx-bulk-grades==0.5.9 +edx-bulk-grades==0.5.10 edx-ccx-keys==0.2.2 edx-celeryutils==0.3.0 edx-completion==2.0.0 @@ -126,7 +126,7 @@ edx-django-release-util==0.3.1 edx-django-sites-extensions==2.3.1 edx-django-utils==2.0.0 edx-drf-extensions==2.4.0 -edx-enterprise==1.9.10 +edx-enterprise==1.9.12 edx-i18n-tools==0.4.8 edx-lint==1.3.0 edx-milestones==0.2.3 @@ -170,7 +170,7 @@ html5lib==1.0.1 httplib2==0.13.1 httpretty==0.9.6 idna==2.8 -importlib-metadata==0.19 # via pluggy, tox +importlib-metadata==0.20 # via pluggy, tox inflect==2.1.0 inflection==0.3.1 ipaddress==1.0.22 @@ -220,7 +220,7 @@ path.py==8.2.1 pathlib2==2.3.4 # via importlib-metadata, pytest, pytest-django pathtools==0.1.2 paver==1.3.4 -pbr==5.4.2 +pbr==5.4.3 pdfminer.six==20181108 piexif==1.0.2 pillow==6.1.0 @@ -287,7 +287,7 @@ sailthru-client==2.2.3 scandir==1.10.0 # via pathlib2 scipy==1.2.1 selenium==3.141.0 -semantic-version==2.8.1 +semantic-version==2.8.2 shapely==1.6.4.post2 shortuuid==0.5.0 simplejson==3.16.0 @@ -301,7 +301,7 @@ sortedcontainers==2.1.0 soupsieve==1.9.3 sqlparse==0.3.0 staff-graded-xblock==0.5 -stevedore==1.30.1 +stevedore==1.31.0 super-csv==0.9.1 sympy==1.4 testfixtures==6.10.0 @@ -309,7 +309,7 @@ text-unidecode==1.2 tincan==0.0.5 toml==0.10.0 # via tox tox-battery==0.5.1 -tox==3.13.2 +tox==3.14.0 transifex-client==0.13.4 typing==3.7.4.1 # via flake8 unicodecsv==0.14.1 @@ -317,7 +317,7 @@ unidiff==0.5.5 uritemplate==3.0.0 urllib3==1.25.3 user-util==0.1.5 -virtualenv==16.7.4 # via tox +virtualenv==16.7.5 # via tox voluptuous==0.11.7 watchdog==0.9.0 wcwidth==0.1.7 # via pytest @@ -325,7 +325,7 @@ web-fragments==0.3.0 webencodings==0.5.1 webob==1.8.5 websocket-client==0.56.0 # via docker -werkzeug==0.15.5 # via moto +werkzeug==0.15.6 # via moto wrapt==1.10.5 git+https://github.com/edx-solutions/xblock-drag-and-drop-v2@v2.2.4#egg=xblock-drag-and-drop-v2==2.2.4 git+https://github.com/open-craft/xblock-poll@add89e14558c30f3c8dc7431e5cd6536fff6d941#egg=xblock-poll==1.5.1