| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.fivehundredpx.provider import FiveHundredPxProvider |
| 6 |
from tests.apps.socialaccount.base import OAuthTestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class FiveHundredPxTests(OAuthTestsMixin, TestCase): |
| 11 |
provider_id = FiveHundredPxProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return [ |
| 15 |
MockedResponse( |
| 16 |
HTTPStatus.OK, |
| 17 |
"""{ |
| 18 |
"user": { |
| 19 |
"id": 5751454, |
| 20 |
"username": "testuser", |
| 21 |
"firstname": "Test", |
| 22 |
"lastname": "User", |
| 23 |
"birthday": null, |
| 24 |
"sex": 0, |
| 25 |
"city": "San Francisco", |
| 26 |
"state": "California", |
| 27 |
"country": "United States", |
| 28 |
"registration_date": "2015-12-12T03:20:31-05:00", |
| 29 |
"about": "About me.", |
| 30 |
"usertype": 0, |
| 31 |
"fotomoto_on": true, |
| 32 |
"locale": "en", |
| 33 |
"show_nude": false, |
| 34 |
"allow_sale_requests": 1, |
| 35 |
"fullname": "Test User", |
| 36 |
"userpic_url": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/1.jpg?1", |
| 37 |
"userpic_https_url": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/1.jpg?1", |
| 38 |
"cover_url": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/cover_2048.jpg?7", |
| 39 |
"upgrade_status": 2, |
| 40 |
"store_on": true, |
| 41 |
"photos_count": 68, |
| 42 |
"galleries_count": 2, |
| 43 |
"affection": 1888, |
| 44 |
"in_favorites_count": 340, |
| 45 |
"friends_count": 181, |
| 46 |
"followers_count": 150, |
| 47 |
"analytics_code": null, |
| 48 |
"invite_pending": false, |
| 49 |
"invite_accepted": false, |
| 50 |
"email": "[email protected]", |
| 51 |
"shadow_email": "[email protected]", |
| 52 |
"upload_limit": null, |
| 53 |
"upload_limit_expiry": "2016-12-01T13:33:55-05:00", |
| 54 |
"upgrade_type": 2, |
| 55 |
"upgrade_status_expiry": "2017-05-27", |
| 56 |
"auth": { |
| 57 |
"facebook": 0, |
| 58 |
"twitter": 0, |
| 59 |
"google_oauth2": 0 |
| 60 |
}, |
| 61 |
"presubmit_for_licensing": null, |
| 62 |
"avatars": { |
| 63 |
"default": { |
| 64 |
"http": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/1.jpg?1", |
| 65 |
"https": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/1.jpg?1" |
| 66 |
}, |
| 67 |
"large": { |
| 68 |
"http": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/2.jpg?1", |
| 69 |
"https": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/2.jpg?1" |
| 70 |
}, |
| 71 |
"small": { |
| 72 |
"http": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/1.jpg?1", |
| 73 |
"https": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/1.jpg?1" |
| 74 |
}, |
| 75 |
"tiny": { |
| 76 |
"http": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/4.jpg?1", |
| 77 |
"https": "https://pacdn.500px.org/10599609/8e20991262c468a866918dcbe2f7e9a30e2c2c9c/4.jpg?1" |
| 78 |
} |
| 79 |
} |
| 80 |
} |
| 81 |
}""", |
| 82 |
) |
| 83 |
] # noqa |
| 84 |
|
| 85 |
def get_expected_to_str(self): |
| 86 |
return "testuser" |