| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.mailru.provider import MailRuProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class MailRuTests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = MailRuProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self, verified_email=True): |
| 14 |
return MockedResponse( |
| 15 |
HTTPStatus.OK, |
| 16 |
""" |
| 17 |
[ { "uid": "15410773191172635989", "first_name": "Евгений", "last_name": "Маслов", "nick": "maslov", "email": "[email protected]", "sex": 0, "birthday": "15.02.1980", "has_pic": 1, "pic": "http://avt.appsmail.ru/mail/emaslov/_avatar", "pic_small": "http://avt.appsmail.ru/mail/emaslov/_avatarsmall", "pic_big": "http://avt.appsmail.ru/mail/emaslov/_avatarbig", "link": "http://my.mail.ru/mail/emaslov/", "referer_type": "", "referer_id": "", "is_online": 1, "friends_count": 145, "is_verified": 1, "vip" : 0, "app_installed": 1, "location": { "country": { "name": "Россия", "id": "24" }, "city": { "name": "Москва", "id": "25" }, "region": { "name": "Москва", "id": "999999" } } }]""", |
| 18 |
) # noqa |
| 19 |
|
| 20 |
def get_login_response_json(self, with_refresh_token=True): |
| 21 |
# TODO: This is not an actual response. I added this in order |
| 22 |
# to get the test suite going but did not verify to check the |
| 23 |
# exact response being returned. |
| 24 |
return '{"access_token": "testac", "uid": "weibo", "refresh_token": "testrf", "x_mailru_vid": "1"}' # noqa |
| 25 |
|
| 26 |
def get_expected_to_str(self): |
| 27 |
return "[email protected]" |