| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.edx.provider import EdxProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class EdxTests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = EdxProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return MockedResponse( |
| 15 |
HTTPStatus.OK, |
| 16 |
"""{ |
| 17 |
"username":"krzysztof", |
| 18 |
"bio":null, |
| 19 |
"requires_parental_consent":true, |
| 20 |
"language_proficiencies":[ |
| 21 |
|
| 22 |
], |
| 23 |
"name":"Krzysztof Hoffmann", |
| 24 |
"country":null, |
| 25 |
"social_links":[ |
| 26 |
|
| 27 |
], |
| 28 |
"is_active":true, |
| 29 |
"profile_image":{ |
| 30 |
"image_url_small":"http://draft.navoica.pl/static/images/profiles/default_30.png", |
| 31 |
"image_url_full":"http://draft.navoica.pl/static/images/profiles/default_500.png", |
| 32 |
"image_url_large":"http://draft.navoica.pl/static/images/profiles/default_120.png", |
| 33 |
"image_url_medium":"http://draft.navoica.pl/static/images/profiles/default_50.png", |
| 34 |
"has_image":false |
| 35 |
}, |
| 36 |
"extended_profile":[ |
| 37 |
|
| 38 |
], |
| 39 |
"year_of_birth":null, |
| 40 |
"level_of_education":null, |
| 41 |
"goals":"", |
| 42 |
"accomplishments_shared":false, |
| 43 |
"gender":null, |
| 44 |
"date_joined":"2019-09-21T07:48:31Z", |
| 45 |
"mailing_address":"", |
| 46 |
"email":"[email protected]", |
| 47 |
"account_privacy":"private" |
| 48 |
}""", |
| 49 |
) |
| 50 |
|
| 51 |
def get_expected_to_str(self): |
| 52 |
return "krzysztof" |