| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.tumblr_oauth2.provider import TumblrOAuth2Provider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class TumblrTests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = TumblrOAuth2Provider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return [ |
| 15 |
MockedResponse( |
| 16 |
HTTPStatus.OK, |
| 17 |
""" |
| 18 |
{ |
| 19 |
"meta": { |
| 20 |
"status": 200, |
| 21 |
"msg": "OK" |
| 22 |
}, |
| 23 |
"response": { |
| 24 |
"user": { |
| 25 |
"following": 263, |
| 26 |
"default_post_format": "html", |
| 27 |
"name": "derekg", |
| 28 |
"likes": 606, |
| 29 |
"blogs": [ |
| 30 |
{ |
| 31 |
"name": "derekg", |
| 32 |
"title": "Derek Gottfrid", |
| 33 |
"url": "http://derekg.org/", |
| 34 |
"tweet": "auto", |
| 35 |
"primary": true, |
| 36 |
"followers": 33004929 |
| 37 |
}, |
| 38 |
{ |
| 39 |
"name": "ihatehipstrz", |
| 40 |
"title": "I Hate Hipstrz" |
| 41 |
} |
| 42 |
] |
| 43 |
} |
| 44 |
} } |
| 45 |
""", |
| 46 |
) |
| 47 |
] |
| 48 |
|
| 49 |
def get_expected_to_str(self): |
| 50 |
return "derekg" |