-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
build: print log messages during test run
- Loading branch information
Showing
6 changed files
with
45 additions
and
24 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,10 @@ | ||
""" | ||
Tests for certificates context overrides. | ||
""" | ||
from unittest.mock import MagicMock, Mock, PropertyMock, patch | ||
from unittest.mock import MagicMock, PropertyMock, patch | ||
|
||
from django.test import TestCase | ||
|
||
from nau_openedx_extensions.certificates.context_overrides import CertificatesContextCohortOverride | ||
|
||
|
||
|
@@ -27,7 +28,7 @@ def test_certificates_context_overrides_no_cohort_and_no_override(self, get_coho | |
} | ||
result = CertificatesContextCohortOverride.run_filter(None, context, "some_template") | ||
get_cohort_mock.assert_not_called() | ||
|
||
self.assertDictEqual(result['context'], { | ||
"username": "[email protected]", | ||
"course_id": "course-v1:Demo+DemoX+Demo_Course", | ||
|
@@ -61,7 +62,7 @@ def test_certificates_context_overrides_with_no_cohort_and_with_override(self, g | |
"username": "[email protected]", | ||
"course_id": "course-v1:Demo+DemoX+Demo_Course", | ||
"footer_additional_logo": "http://lms.example.com/base_logo.png", | ||
"cohort_overrides" : { | ||
"cohort_overrides": { | ||
"SomeGroup": { | ||
"footer_additional_logo": "http://lms.example.com/override_logo.png", | ||
}, | ||
|
@@ -74,18 +75,18 @@ def test_certificates_context_overrides_with_no_cohort_and_with_override(self, g | |
"username": "[email protected]", | ||
"course_id": "course-v1:Demo+DemoX+Demo_Course", | ||
"footer_additional_logo": "http://lms.example.com/base_logo.png", | ||
"cohort_overrides" : { | ||
"cohort_overrides": { | ||
"SomeGroup": { | ||
"footer_additional_logo": "http://lms.example.com/override_logo.png", | ||
}, | ||
}, | ||
}) | ||
|
||
|
||
@patch('nau_openedx_extensions.certificates.context_overrides.get_cohort') | ||
def test_certificates_context_overrides_with_cohort_and_override_dont_match(self, get_cohort_mock): | ||
""" | ||
Check that the override isn't being applied when the learner belongs to a cohort that isn't configured on the override. | ||
Check that the override isn't being applied when the learner belongs to a cohort that isn't configured on the | ||
override. | ||
""" | ||
mocked_cohort = MagicMock() | ||
cohort_name_property = PropertyMock(return_value="some_group_not_configured_on_override") | ||
|
@@ -96,7 +97,7 @@ def test_certificates_context_overrides_with_cohort_and_override_dont_match(self | |
"username": "[email protected]", | ||
"course_id": "course-v1:Demo+DemoX+Demo_Course", | ||
"footer_additional_logo": "http://lms.example.com/base_logo.png", | ||
"cohort_overrides" : { | ||
"cohort_overrides": { | ||
"SomeGroup": { | ||
"footer_additional_logo": "http://lms.example.com/override_logo.png", | ||
}, | ||
|
@@ -109,7 +110,7 @@ def test_certificates_context_overrides_with_cohort_and_override_dont_match(self | |
"username": "[email protected]", | ||
"course_id": "course-v1:Demo+DemoX+Demo_Course", | ||
"footer_additional_logo": "http://lms.example.com/base_logo.png", | ||
"cohort_overrides" : { | ||
"cohort_overrides": { | ||
"SomeGroup": { | ||
"footer_additional_logo": "http://lms.example.com/override_logo.png", | ||
}, | ||
|
@@ -119,7 +120,8 @@ def test_certificates_context_overrides_with_cohort_and_override_dont_match(self | |
@patch('nau_openedx_extensions.certificates.context_overrides.get_cohort') | ||
def test_certificates_context_overrides_with_cohort_and_override(self, get_cohort_mock): | ||
""" | ||
Check that the override is being applied if the learner belongs to a cohort and that cohort is configured has override. | ||
Check that the override is being applied if the learner belongs to a cohort and that cohort | ||
is configured has override. | ||
""" | ||
mocked_cohort = MagicMock() | ||
cohort_name_property = PropertyMock(return_value="SomeGroup") | ||
|
@@ -130,7 +132,7 @@ def test_certificates_context_overrides_with_cohort_and_override(self, get_cohor | |
"username": "[email protected]", | ||
"course_id": "course-v1:Demo+DemoX+Demo_Course", | ||
"footer_additional_logo": "http://lms.example.com/base_logo.png", | ||
"cohort_overrides" : { | ||
"cohort_overrides": { | ||
"SomeGroup": { | ||
"footer_additional_logo": "http://lms.example.com/override_logo.png", | ||
}, | ||
|
@@ -143,7 +145,7 @@ def test_certificates_context_overrides_with_cohort_and_override(self, get_cohor | |
"username": "[email protected]", | ||
"course_id": "course-v1:Demo+DemoX+Demo_Course", | ||
"footer_additional_logo": "http://lms.example.com/override_logo.png", | ||
"cohort_overrides" : { | ||
"cohort_overrides": { | ||
"SomeGroup": { | ||
"footer_additional_logo": "http://lms.example.com/override_logo.png", | ||
}, | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
[tool:pytest] | ||
DJANGO_SETTINGS_MODULE = nau_openedx_extensions.settings.test | ||
|
||
[pytest] | ||
log_cli = 1 | ||
log_cli_level = INFO |