| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.bitly.provider import BitlyProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class BitlyTests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = BitlyProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return MockedResponse( |
| 15 |
HTTPStatus.OK, |
| 16 |
"""{ |
| 17 |
"data": { |
| 18 |
"apiKey": "R_f6397a37e765574f2e198dba5bb59522", |
| 19 |
"custom_short_domain": null, |
| 20 |
"display_name": null, |
| 21 |
"full_name": "Bitly API Oauth Demo Account", |
| 22 |
"is_enterprise": false, |
| 23 |
"login": "bitlyapioauthdemo", |
| 24 |
"member_since": 1331567982, |
| 25 |
"profile_image": "http://bitly.com/u/bitlyapioauthdemo.png", |
| 26 |
"profile_url": "http://bitly.com/u/bitlyapioauthdemo", |
| 27 |
"share_accounts": [], |
| 28 |
"tracking_domains": [] |
| 29 |
}, |
| 30 |
"status_code": 200, |
| 31 |
"status_txt": "OK" |
| 32 |
}""", |
| 33 |
) |
| 34 |
|
| 35 |
def get_expected_to_str(self): |
| 36 |
return "bitlyapioauthdemo" |