Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
E
edx-platform
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
edx
edx-platform
Commits
fb3a09e6
Commit
fb3a09e6
authored
Feb 12, 2016
by
Jim Abramson
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #11520 from edx/jsa/ecom-3638
Specify high priority queue for credentials generation task.
parents
526e1748
46ad8a33
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
36 additions
and
9 deletions
+36
-9
cms/envs/common.py
+0
-8
lms/envs/aws.py
+4
-0
lms/envs/common.py
+1
-0
lms/envs/yaml_config.py
+4
-0
openedx/core/djangoapps/credentials/tests/test_models.py
+5
-0
openedx/core/djangoapps/credentials/tests/test_utils.py
+4
-0
openedx/core/djangoapps/programs/tasks/v1/tasks.py
+3
-1
openedx/core/djangoapps/programs/tasks/v1/tests/test_tasks.py
+7
-0
openedx/core/djangoapps/programs/tests/test_utils.py
+4
-0
openedx/core/lib/tests/test_edx_api_utils.py
+4
-0
No files found.
cms/envs/common.py
View file @
fb3a09e6
...
@@ -849,9 +849,6 @@ INSTALLED_APPS = (
...
@@ -849,9 +849,6 @@ INSTALLED_APPS = (
# Microsite configuration application
# Microsite configuration application
'microsite_configuration'
,
'microsite_configuration'
,
# Credentials support
'openedx.core.djangoapps.credentials'
,
# edx-milestones service
# edx-milestones service
'milestones'
,
'milestones'
,
...
@@ -1130,8 +1127,3 @@ USERNAME_PATTERN = r'(?P<username>[\w.@+-]+)'
...
@@ -1130,8 +1127,3 @@ USERNAME_PATTERN = r'(?P<username>[\w.@+-]+)'
# Partner support link for CMS footer
# Partner support link for CMS footer
PARTNER_SUPPORT_EMAIL
=
''
PARTNER_SUPPORT_EMAIL
=
''
################################ Settings for Credentials Service ################################
CREDENTIALS_SERVICE_USERNAME
=
'credentials_service_user'
lms/envs/aws.py
View file @
fb3a09e6
...
@@ -762,3 +762,7 @@ MAX_BOOKMARKS_PER_COURSE = ENV_TOKENS.get('MAX_BOOKMARKS_PER_COURSE', MAX_BOOKMA
...
@@ -762,3 +762,7 @@ MAX_BOOKMARKS_PER_COURSE = ENV_TOKENS.get('MAX_BOOKMARKS_PER_COURSE', MAX_BOOKMA
# Cutoff date for granting audit certificates
# Cutoff date for granting audit certificates
if
ENV_TOKENS
.
get
(
'AUDIT_CERT_CUTOFF_DATE'
,
None
):
if
ENV_TOKENS
.
get
(
'AUDIT_CERT_CUTOFF_DATE'
,
None
):
AUDIT_CERT_CUTOFF_DATE
=
dateutil
.
parser
.
parse
(
ENV_TOKENS
.
get
(
'AUDIT_CERT_CUTOFF_DATE'
))
AUDIT_CERT_CUTOFF_DATE
=
dateutil
.
parser
.
parse
(
ENV_TOKENS
.
get
(
'AUDIT_CERT_CUTOFF_DATE'
))
################################ Settings for Credentials Service ################################
CREDENTIALS_GENERATION_ROUTING_KEY
=
HIGH_PRIORITY_QUEUE
lms/envs/common.py
View file @
fb3a09e6
...
@@ -2768,3 +2768,4 @@ AUDIT_CERT_CUTOFF_DATE = None
...
@@ -2768,3 +2768,4 @@ AUDIT_CERT_CUTOFF_DATE = None
################################ Settings for Credentials Service ################################
################################ Settings for Credentials Service ################################
CREDENTIALS_SERVICE_USERNAME
=
'credentials_service_user'
CREDENTIALS_SERVICE_USERNAME
=
'credentials_service_user'
CREDENTIALS_GENERATION_ROUTING_KEY
=
HIGH_PRIORITY_QUEUE
lms/envs/yaml_config.py
View file @
fb3a09e6
...
@@ -313,3 +313,7 @@ if FEATURES.get('INDIVIDUAL_DUE_DATES'):
...
@@ -313,3 +313,7 @@ if FEATURES.get('INDIVIDUAL_DUE_DATES'):
if
FEATURES
.
get
(
'ENABLE_LTI_PROVIDER'
):
if
FEATURES
.
get
(
'ENABLE_LTI_PROVIDER'
):
INSTALLED_APPS
+=
(
'lti_provider'
,)
INSTALLED_APPS
+=
(
'lti_provider'
,)
AUTHENTICATION_BACKENDS
+=
(
'lti_provider.users.LtiBackend'
,
)
AUTHENTICATION_BACKENDS
+=
(
'lti_provider.users.LtiBackend'
,
)
################################ Settings for Credentials Service ################################
CREDENTIALS_GENERATION_ROUTING_KEY
=
HIGH_PRIORITY_QUEUE
openedx/core/djangoapps/credentials/tests/test_models.py
View file @
fb3a09e6
"""Tests for models supporting Credentials-related functionality."""
"""Tests for models supporting Credentials-related functionality."""
import
unittest
from
django.conf
import
settings
from
django.test
import
TestCase
from
django.test
import
TestCase
from
openedx.core.djangoapps.credentials.tests.mixins
import
CredentialsApiConfigMixin
from
openedx.core.djangoapps.credentials.tests.mixins
import
CredentialsApiConfigMixin
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
TestCredentialsApiConfig
(
CredentialsApiConfigMixin
,
TestCase
):
class
TestCredentialsApiConfig
(
CredentialsApiConfigMixin
,
TestCase
):
"""Tests covering the CredentialsApiConfig model."""
"""Tests covering the CredentialsApiConfig model."""
def
test_url_construction
(
self
):
def
test_url_construction
(
self
):
...
...
openedx/core/djangoapps/credentials/tests/test_utils.py
View file @
fb3a09e6
"""Tests covering Credentials utilities."""
"""Tests covering Credentials utilities."""
import
unittest
from
django.conf
import
settings
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.test
import
TestCase
from
django.test
import
TestCase
import
httpretty
import
httpretty
...
@@ -15,6 +18,7 @@ from openedx.core.djangoapps.programs.models import ProgramsApiConfig
...
@@ -15,6 +18,7 @@ from openedx.core.djangoapps.programs.models import ProgramsApiConfig
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
TestCredentialsRetrieval
(
ProgramsApiConfigMixin
,
CredentialsApiConfigMixin
,
CredentialsDataMixin
,
class
TestCredentialsRetrieval
(
ProgramsApiConfigMixin
,
CredentialsApiConfigMixin
,
CredentialsDataMixin
,
ProgramsDataMixin
,
TestCase
):
ProgramsDataMixin
,
TestCase
):
""" Tests covering the retrieval of user credentials from the Credentials
""" Tests covering the retrieval of user credentials from the Credentials
...
...
openedx/core/djangoapps/programs/tasks/v1/tasks.py
View file @
fb3a09e6
...
@@ -17,6 +17,8 @@ from openedx.core.lib.token_utils import get_id_token
...
@@ -17,6 +17,8 @@ from openedx.core.lib.token_utils import get_id_token
LOGGER
=
get_task_logger
(
__name__
)
LOGGER
=
get_task_logger
(
__name__
)
# Under cms the following setting is not defined, leading to errors during tests.
ROUTING_KEY
=
getattr
(
settings
,
'CREDENTIALS_GENERATION_ROUTING_KEY'
,
None
)
def
get_api_client
(
api_config
,
student
):
def
get_api_client
(
api_config
,
student
):
...
@@ -115,7 +117,7 @@ def award_program_certificate(client, username, program_id):
...
@@ -115,7 +117,7 @@ def award_program_certificate(client, username, program_id):
})
})
@task
(
bind
=
True
,
ignore_result
=
True
)
@task
(
bind
=
True
,
ignore_result
=
True
,
routing_key
=
ROUTING_KEY
)
def
award_program_certificates
(
self
,
username
):
def
award_program_certificates
(
self
,
username
):
"""
"""
This task is designed to be called whenever a student's completion status
This task is designed to be called whenever a student's completion status
...
...
openedx/core/djangoapps/programs/tasks/v1/tests/test_tasks.py
View file @
fb3a09e6
...
@@ -6,6 +6,7 @@ import ddt
...
@@ -6,6 +6,7 @@ import ddt
import
httpretty
import
httpretty
import
json
import
json
import
mock
import
mock
import
unittest
from
celery.exceptions
import
MaxRetriesExceededError
from
celery.exceptions
import
MaxRetriesExceededError
from
django.conf
import
settings
from
django.conf
import
settings
...
@@ -22,6 +23,7 @@ from student.tests.factories import UserFactory
...
@@ -22,6 +23,7 @@ from student.tests.factories import UserFactory
TASKS_MODULE
=
'openedx.core.djangoapps.programs.tasks.v1.tasks'
TASKS_MODULE
=
'openedx.core.djangoapps.programs.tasks.v1.tasks'
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
GetApiClientTestCase
(
TestCase
,
ProgramsApiConfigMixin
):
class
GetApiClientTestCase
(
TestCase
,
ProgramsApiConfigMixin
):
"""
"""
Test the get_api_client function
Test the get_api_client function
...
@@ -46,6 +48,7 @@ class GetApiClientTestCase(TestCase, ProgramsApiConfigMixin):
...
@@ -46,6 +48,7 @@ class GetApiClientTestCase(TestCase, ProgramsApiConfigMixin):
self
.
assertEqual
(
api_client
.
_store
[
'session'
]
.
auth
.
token
,
'test-token'
)
# pylint: disable=protected-access
self
.
assertEqual
(
api_client
.
_store
[
'session'
]
.
auth
.
token
,
'test-token'
)
# pylint: disable=protected-access
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
GetCompletedCoursesTestCase
(
TestCase
):
class
GetCompletedCoursesTestCase
(
TestCase
):
"""
"""
Test the get_completed_courses function
Test the get_completed_courses function
...
@@ -89,6 +92,7 @@ class GetCompletedCoursesTestCase(TestCase):
...
@@ -89,6 +92,7 @@ class GetCompletedCoursesTestCase(TestCase):
])
])
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
GetCompletedProgramsTestCase
(
TestCase
):
class
GetCompletedProgramsTestCase
(
TestCase
):
"""
"""
Test the get_completed_programs function
Test the get_completed_programs function
...
@@ -115,6 +119,7 @@ class GetCompletedProgramsTestCase(TestCase):
...
@@ -115,6 +119,7 @@ class GetCompletedProgramsTestCase(TestCase):
self
.
assertEqual
(
result
,
[
1
,
2
,
3
])
self
.
assertEqual
(
result
,
[
1
,
2
,
3
])
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
GetAwardedCertificateProgramsTestCase
(
TestCase
):
class
GetAwardedCertificateProgramsTestCase
(
TestCase
):
"""
"""
Test the get_awarded_certificate_programs function
Test the get_awarded_certificate_programs function
...
@@ -155,6 +160,7 @@ class GetAwardedCertificateProgramsTestCase(TestCase):
...
@@ -155,6 +160,7 @@ class GetAwardedCertificateProgramsTestCase(TestCase):
self
.
assertEqual
(
result
,
[
1
])
self
.
assertEqual
(
result
,
[
1
])
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
AwardProgramCertificateTestCase
(
TestCase
):
class
AwardProgramCertificateTestCase
(
TestCase
):
"""
"""
Test the award_program_certificate function
Test the award_program_certificate function
...
@@ -183,6 +189,7 @@ class AwardProgramCertificateTestCase(TestCase):
...
@@ -183,6 +189,7 @@ class AwardProgramCertificateTestCase(TestCase):
self
.
assertEqual
(
json
.
loads
(
httpretty
.
last_request
()
.
body
),
expected_body
)
self
.
assertEqual
(
json
.
loads
(
httpretty
.
last_request
()
.
body
),
expected_body
)
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@ddt.ddt
@ddt.ddt
@mock.patch
(
TASKS_MODULE
+
'.award_program_certificate'
)
@mock.patch
(
TASKS_MODULE
+
'.award_program_certificate'
)
@mock.patch
(
TASKS_MODULE
+
'.get_awarded_certificate_programs'
)
@mock.patch
(
TASKS_MODULE
+
'.get_awarded_certificate_programs'
)
...
...
openedx/core/djangoapps/programs/tests/test_utils.py
View file @
fb3a09e6
"""Tests covering Programs utilities."""
"""Tests covering Programs utilities."""
import
unittest
from
django.conf
import
settings
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.test
import
TestCase
from
django.test
import
TestCase
import
httpretty
import
httpretty
...
@@ -15,6 +18,7 @@ from openedx.core.djangoapps.programs.utils import (
...
@@ -15,6 +18,7 @@ from openedx.core.djangoapps.programs.utils import (
from
student.tests.factories
import
UserFactory
from
student.tests.factories
import
UserFactory
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
class
TestProgramRetrieval
(
ProgramsApiConfigMixin
,
ProgramsDataMixin
,
class
TestProgramRetrieval
(
ProgramsApiConfigMixin
,
ProgramsDataMixin
,
CredentialsApiConfigMixin
,
TestCase
):
CredentialsApiConfigMixin
,
TestCase
):
"""Tests covering the retrieval of programs from the Programs service."""
"""Tests covering the retrieval of programs from the Programs service."""
...
...
openedx/core/lib/tests/test_edx_api_utils.py
View file @
fb3a09e6
"""Tests covering Api utils."""
"""Tests covering Api utils."""
import
unittest
from
django.conf
import
settings
from
django.core.cache
import
cache
from
django.core.cache
import
cache
from
django.test
import
TestCase
from
django.test
import
TestCase
import
httpretty
import
httpretty
...
@@ -95,6 +97,8 @@ class TestApiDataRetrieval(CredentialsApiConfigMixin, CredentialsDataMixin, Prog
...
@@ -95,6 +97,8 @@ class TestApiDataRetrieval(CredentialsApiConfigMixin, CredentialsDataMixin, Prog
)
)
self
.
assertEqual
(
actual
,
[])
self
.
assertEqual
(
actual
,
[])
# this test is skipped under cms because the credentials app is only installed under LMS.
@unittest.skipUnless
(
settings
.
ROOT_URLCONF
==
'lms.urls'
,
'Test only valid in lms'
)
@httpretty.activate
@httpretty.activate
def
test_get_edx_api_data_multiple_page
(
self
):
def
test_get_edx_api_data_multiple_page
(
self
):
"""Verify that all data is retrieve for multiple page response."""
"""Verify that all data is retrieve for multiple page response."""
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment