| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.hubic.provider import HubicProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class HubicTests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = HubicProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return MockedResponse( |
| 15 |
HTTPStatus.OK, |
| 16 |
""" |
| 17 |
{ |
| 18 |
"email": "[email protected]", |
| 19 |
"firstname": "Test", |
| 20 |
"activated": true, |
| 21 |
"creationDate": "2014-04-17T17:04:01+02:00", |
| 22 |
"language": "en", |
| 23 |
"status": "ok", |
| 24 |
"offer": "25g", |
| 25 |
"lastname": "User" |
| 26 |
} |
| 27 |
""", |
| 28 |
) |
| 29 |
|
| 30 |
def get_expected_to_str(self): |
| 31 |
return "[email protected]" |
| 32 |
|
| 33 |
def get_login_response_json(self, with_refresh_token=True): |
| 34 |
return '{\ |
| 35 |
"access_token": "testac",\ |
| 36 |
"expires_in": "3600",\ |
| 37 |
"refresh_token": "testrf",\ |
| 38 |
"token_type": "Bearer"\ |
| 39 |
}' |