| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.mediawiki.provider import MediaWikiProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class MediaWikiTests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = MediaWikiProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return MockedResponse( |
| 15 |
HTTPStatus.OK, |
| 16 |
""" |
| 17 |
{ |
| 18 |
"iss": "https://meta.wikimedia.org", |
| 19 |
"sub": 12345, |
| 20 |
"aud": "1234567890abcdef", |
| 21 |
"exp": 946681300, |
| 22 |
"iat": 946681200, |
| 23 |
"username": "John Doe", |
| 24 |
"editcount": 123, |
| 25 |
"confirmed_email": true, |
| 26 |
"blocked": false, |
| 27 |
"registered": "20000101000000", |
| 28 |
"groups": ["*", "user", "autoconfirmed"], |
| 29 |
"rights": ["read", "edit"], |
| 30 |
"grants": ["basic"], |
| 31 |
"email": "[email protected]" |
| 32 |
} |
| 33 |
""", |
| 34 |
) |
| 35 |
|
| 36 |
def get_expected_to_str(self): |
| 37 |
return "John Doe" |