| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.clever.provider import CleverProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class CleverOAuth2Tests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = CleverProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return [ |
| 15 |
MockedResponse( |
| 16 |
HTTPStatus.OK, |
| 17 |
"""{ |
| 18 |
"type": "user", |
| 19 |
"data": { |
| 20 |
"id": "62027798269867124d10259e", |
| 21 |
"district": "6202763c8243d2100123dae5", |
| 22 |
"type": "user", |
| 23 |
"authorized_by": "district" |
| 24 |
}, |
| 25 |
"links": [ |
| 26 |
{ |
| 27 |
"rel": "self", |
| 28 |
"uri": "/me" |
| 29 |
}, |
| 30 |
{ |
| 31 |
"rel": "canonical", |
| 32 |
"uri": "/v3.0/users/62027798269867124d10259e" |
| 33 |
}, |
| 34 |
{ |
| 35 |
"rel": "district", |
| 36 |
"uri": "/v3.0/districts/6202763c8243d2100123dae5" |
| 37 |
} |
| 38 |
] |
| 39 |
}""", |
| 40 |
), |
| 41 |
MockedResponse( |
| 42 |
HTTPStatus.OK, |
| 43 |
"""{ |
| 44 |
"data": { |
| 45 |
"id": "62027798269867124d10259e", |
| 46 |
"roles": { |
| 47 |
"district_admin": {}, |
| 48 |
"contact": {} |
| 49 |
} |
| 50 |
} |
| 51 |
}""", |
| 52 |
), |
| 53 |
] |
| 54 |
|
| 55 |
def get_expected_to_str(self): |
| 56 |
return "Clever" |