forked from openedx/edx-platform
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge tag 'open-release/palm.3' of github.com:EduTrigger/edx-platform…
… into viceclass-prod
- Loading branch information
Showing
18 changed files
with
442 additions
and
60 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
{% load i18n %} | ||
{% load django_markup %} | ||
<p id="hint_id_content" class="help-block"> | ||
{% filter force_escape %} | ||
{% blocktrans with start_link="<a id='cheatsheetLink' href='#cheatsheetModal' rel='leanModal'>" end_link="</a>" trimmed %} | ||
Markdown syntax is allowed. See the {{ start_link }}cheatsheet{{ end_link }} for help. | ||
{% blocktrans trimmed asvar tmsg %} | ||
Markdown syntax is allowed. See the {start_link}cheatsheet{end_link} for help. | ||
{% endblocktrans %} | ||
{% endfilter %} | ||
{% interpolate_html tmsg start_link='<a id="cheatsheetLink" href="#cheatsheetModal" rel="leanModal">'|safe end_link='</a>'|safe %} | ||
</p> | ||
<textarea {{ attrs }}>{{ content }}</textarea> |
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
141 changes: 141 additions & 0 deletions
141
openedx/core/djangoapps/user_authn/api/tests/test_data.py
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,141 @@ | ||
""" Mocked data for testing """ | ||
|
||
mfe_context_data_keys = { | ||
'contextData', | ||
'registrationFields', | ||
'optionalFields' | ||
} | ||
|
||
mock_mfe_context_data = { | ||
'context_data': { | ||
'currentProvider': 'edX', | ||
'platformName': 'edX', | ||
'providers': [ | ||
{ | ||
'id': 'oa2-facebook', | ||
'name': 'Facebook', | ||
'iconClass': 'fa-facebook', | ||
'iconImage': None, | ||
'skipHintedLogin': False, | ||
'skipRegistrationForm': False, | ||
'loginUrl': 'https://facebook.com/login', | ||
'registerUrl': 'https://facebook.com/register' | ||
}, | ||
{ | ||
'id': 'oa2-google-oauth2', | ||
'name': 'Google', | ||
'iconClass': 'fa-google-plus', | ||
'iconImage': None, | ||
'skipHintedLogin': False, | ||
'skipRegistrationForm': False, | ||
'loginUrl': 'https://google.com/login', | ||
'registerUrl': 'https://google.com/register' | ||
} | ||
], | ||
'secondaryProviders': [], | ||
'finishAuthUrl': 'https://edx.com/auth/finish', | ||
'errorMessage': None, | ||
'registerFormSubmitButtonText': 'Create Account', | ||
'autoSubmitRegForm': False, | ||
'syncLearnerProfileData': False, | ||
'countryCode': '', | ||
'pipeline_user_details': { | ||
'username': 'test123', | ||
'email': '[email protected]', | ||
'fullname': 'Test Test', | ||
'first_name': 'Test', | ||
'last_name': 'Test' | ||
} | ||
}, | ||
'registration_fields': {}, | ||
'optional_fields': { | ||
'extended_profile': [] | ||
} | ||
} | ||
|
||
mock_default_mfe_context_data = { | ||
'context_data': { | ||
'currentProvider': None, | ||
'platformName': 'édX', | ||
'providers': [], | ||
'secondaryProviders': [], | ||
'finishAuthUrl': None, | ||
'errorMessage': None, | ||
'registerFormSubmitButtonText': 'Create Account', | ||
'autoSubmitRegForm': False, | ||
'syncLearnerProfileData': False, | ||
'countryCode': '', | ||
'pipeline_user_details': {} | ||
}, | ||
'registration_fields': {}, | ||
'optional_fields': { | ||
'extended_profile': [] | ||
} | ||
} | ||
|
||
expected_mfe_context_data = { | ||
'contextData': { | ||
'currentProvider': 'edX', | ||
'platformName': 'edX', | ||
'providers': [ | ||
{ | ||
'id': 'oa2-facebook', | ||
'name': 'Facebook', | ||
'iconClass': 'fa-facebook', | ||
'iconImage': None, | ||
'skipHintedLogin': False, | ||
'skipRegistrationForm': False, | ||
'loginUrl': 'https://facebook.com/login', | ||
'registerUrl': 'https://facebook.com/register' | ||
}, | ||
{ | ||
'id': 'oa2-google-oauth2', | ||
'name': 'Google', | ||
'iconClass': 'fa-google-plus', | ||
'iconImage': None, | ||
'skipHintedLogin': False, | ||
'skipRegistrationForm': False, | ||
'loginUrl': 'https://google.com/login', | ||
'registerUrl': 'https://google.com/register' | ||
} | ||
], | ||
'secondaryProviders': [], | ||
'finishAuthUrl': 'https://edx.com/auth/finish', | ||
'errorMessage': None, | ||
'registerFormSubmitButtonText': 'Create Account', | ||
'autoSubmitRegForm': False, | ||
'syncLearnerProfileData': False, | ||
'countryCode': '', | ||
'pipelineUserDetails': { | ||
'username': 'test123', | ||
'email': '[email protected]', | ||
'name': 'Test Test', | ||
'firstName': 'Test', | ||
'lastName': 'Test' | ||
} | ||
}, | ||
'registrationFields': {}, | ||
'optionalFields': { | ||
'extended_profile': [] | ||
} | ||
} | ||
|
||
default_expected_mfe_context_data = { | ||
'contextData': { | ||
'currentProvider': None, | ||
'platformName': 'édX', | ||
'providers': [], | ||
'secondaryProviders': [], | ||
'finishAuthUrl': None, | ||
'errorMessage': None, | ||
'registerFormSubmitButtonText': 'Create Account', | ||
'autoSubmitRegForm': False, | ||
'syncLearnerProfileData': False, | ||
'countryCode': '', | ||
'pipelineUserDetails': {} | ||
}, | ||
'registrationFields': {}, | ||
'optionalFields': { | ||
'extended_profile': [] | ||
} | ||
} |
44 changes: 44 additions & 0 deletions
44
openedx/core/djangoapps/user_authn/api/tests/test_serializers.py
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,44 @@ | ||
"""Tests for serializers for the MFE Context""" | ||
|
||
from django.test import TestCase | ||
|
||
from openedx.core.djangoapps.user_authn.api.tests.test_data import ( | ||
mock_mfe_context_data, | ||
expected_mfe_context_data, | ||
mock_default_mfe_context_data, | ||
default_expected_mfe_context_data, | ||
) | ||
from openedx.core.djangoapps.user_authn.serializers import MFEContextSerializer | ||
|
||
|
||
class TestMFEContextSerializer(TestCase): | ||
""" | ||
High-level unit tests for MFEContextSerializer | ||
""" | ||
|
||
def test_mfe_context_serializer(self): | ||
""" | ||
Test MFEContextSerializer with mock data that serializes data correctly | ||
""" | ||
|
||
output_data = MFEContextSerializer( | ||
mock_mfe_context_data | ||
).data | ||
|
||
self.assertDictEqual( | ||
output_data, | ||
expected_mfe_context_data | ||
) | ||
|
||
def test_mfe_context_serializer_default_response(self): | ||
""" | ||
Test MFEContextSerializer with default data | ||
""" | ||
serialized_data = MFEContextSerializer( | ||
mock_default_mfe_context_data | ||
).data | ||
|
||
self.assertDictEqual( | ||
serialized_data, | ||
default_expected_mfe_context_data | ||
) |
Oops, something went wrong.