| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.twitter_oauth2.provider import ( |
| 6 |
TwitterOAuth2Provider, |
| 7 |
) |
| 8 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 9 |
from tests.mocking import MockedResponse |
| 10 |
|
| 11 |
|
| 12 |
class TwitterOAuth2Tests(OAuth2TestsMixin, TestCase): |
| 13 |
provider_id = TwitterOAuth2Provider.id |
| 14 |
|
| 15 |
def get_mocked_response(self): |
| 16 |
return MockedResponse( |
| 17 |
HTTPStatus.OK, |
| 18 |
"""{ |
| 19 |
"data": { |
| 20 |
"created_at": "2020-09-02T13:39:14.000Z", |
| 21 |
"id": "1301152652357595137", |
| 22 |
"verified": false, |
| 23 |
"username": "realllkk520", |
| 24 |
"name": "realllkk520", |
| 25 |
"profile_image_url": "https://pbs.twimg.com/profile_images/1537259565632593920/OoRGPbUg_normal.jpg" |
| 26 |
} |
| 27 |
} |
| 28 |
""", |
| 29 |
) # noqa |
| 30 |
|
| 31 |
def get_expected_to_str(self): |
| 32 |
return "realllkk520" |