| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.patreon.provider import PatreonProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class PatreonTests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = PatreonProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return MockedResponse( |
| 15 |
HTTPStatus.OK, |
| 16 |
"""{ |
| 17 |
"data": { |
| 18 |
"relationships": { |
| 19 |
"pledges": { |
| 20 |
"data": [{ |
| 21 |
"type": "pledge", "id": "123456" |
| 22 |
}] |
| 23 |
} |
| 24 |
}, |
| 25 |
"attributes": { |
| 26 |
"last_name": "Interwebs", |
| 27 |
"is_suspended": false, |
| 28 |
"has_password": true, |
| 29 |
"full_name": "John Interwebs", |
| 30 |
"is_nuked": false, |
| 31 |
"first_name": "John", |
| 32 |
"social_connections": { |
| 33 |
"spotify": null, |
| 34 |
"discord": null, |
| 35 |
"twitter": null, |
| 36 |
"youtube": null, |
| 37 |
"facebook": null, |
| 38 |
"deviantart": null, |
| 39 |
"twitch": null |
| 40 |
}, |
| 41 |
"twitter": null, |
| 42 |
"is_email_verified": true, |
| 43 |
"facebook_id": null, |
| 44 |
"email": "[email protected]", |
| 45 |
"facebook": null, |
| 46 |
"thumb_url": "https://c8.patreon.com/100/123456", |
| 47 |
"vanity": null, |
| 48 |
"about": null, |
| 49 |
"is_deleted": false, |
| 50 |
"created": "2017-05-05T05:16:34+00:00", |
| 51 |
"url": "https://www.patreon.com/user?u=123456", |
| 52 |
"gender": 0, |
| 53 |
"youtube": null, |
| 54 |
"discord_id": null, |
| 55 |
"image_url": "https://c8.patreon.com/400/123456", |
| 56 |
"twitch": null |
| 57 |
}, |
| 58 |
"type": "user", |
| 59 |
"id": "123456" |
| 60 |
} |
| 61 |
}""", |
| 62 |
) # noqa |
| 63 |
|
| 64 |
def get_expected_to_str(self): |
| 65 |
return "[email protected]" |