| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.odnoklassniki.provider import OdnoklassnikiProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class OdnoklassnikiTests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = OdnoklassnikiProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self, verified_email=True): |
| 14 |
return MockedResponse( |
| 15 |
HTTPStatus.OK, |
| 16 |
""" |
| 17 |
{"uid":"561999209121","birthday":"1999-09-09","age":33,"first_name":"Ivan", |
| 18 |
"last_name":"Petrov","name":"Ivan Petrov","locale":"en","gender":"male", |
| 19 |
"has_email":true,"location":{"city":"Moscow","country":"RUSSIAN_FEDERATION", |
| 20 |
"countryCode":"RU","countryName":"Russia"},"online":"web","pic_1": |
| 21 |
"http://i500.mycdn.me/res/stub_50x50.gif", |
| 22 |
"pic_2":"http://usd1.mycdn.me/res/stub_128x96.gif"} |
| 23 |
""", |
| 24 |
) |
| 25 |
|
| 26 |
def get_expected_to_str(self): |
| 27 |
return "Ivan Petrov" |
| 28 |
|
| 29 |
def get_login_response_json(self, with_refresh_token=True): |
| 30 |
return '{"access_token": "testac"}' # noqa |