| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.twentythreeandme.provider import ( |
| 6 |
TwentyThreeAndMeProvider, |
| 7 |
) |
| 8 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 9 |
from tests.mocking import MockedResponse |
| 10 |
|
| 11 |
|
| 12 |
class TwentyThreeAndMeTests(OAuth2TestsMixin, TestCase): |
| 13 |
provider_id = TwentyThreeAndMeProvider.id |
| 14 |
|
| 15 |
def get_mocked_response(self): |
| 16 |
return MockedResponse( |
| 17 |
HTTPStatus.OK, |
| 18 |
""" |
| 19 |
{ |
| 20 |
"profiles": [ |
| 21 |
{"id": "56c46bdb0902f8e2", "genotyped": false} |
| 22 |
], |
| 23 |
"id": "b4b975a5a6a1b80b" |
| 24 |
} |
| 25 |
""", |
| 26 |
) |
| 27 |
|
| 28 |
def get_expected_to_str(self): |
| 29 |
return "23andMe" |
| 30 |
|
| 31 |
def get_login_response_json(self, with_refresh_token=True): |
| 32 |
return """ |
| 33 |
{ |
| 34 |
"access_token":"testac", |
| 35 |
"token_type":"bearer", |
| 36 |
"expires_in": 86400, |
| 37 |
"refresh_token":"33c53cd7bb", |
| 38 |
"scope":"basic" |
| 39 |
}""" |