| 1 |
"""Test MailChimp OAuth2 v3 Flow.""" |
| 2 |
|
| 3 |
from http import HTTPStatus |
| 4 |
|
| 5 |
from django.test import TestCase |
| 6 |
|
| 7 |
from allauth.socialaccount.providers.mailchimp.provider import MailChimpProvider |
| 8 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 9 |
from tests.mocking import MockedResponse |
| 10 |
|
| 11 |
|
| 12 |
class MailChimpTests(OAuth2TestsMixin, TestCase): |
| 13 |
"""Test Class for MailChimp OAuth2 v3.""" |
| 14 |
|
| 15 |
provider_id = MailChimpProvider.id |
| 16 |
|
| 17 |
def get_mocked_response(self): |
| 18 |
"""Test authentication with an non-null avatar.""" |
| 19 |
return MockedResponse( |
| 20 |
HTTPStatus.OK, |
| 21 |
"""{ |
| 22 |
"dc": "usX", |
| 23 |
"role": "owner", |
| 24 |
"accountname": "Name can have spaces", |
| 25 |
"user_id": "99999999", |
| 26 |
"login": { |
| 27 |
"email": "[email protected]", |
| 28 |
"avatar": "http://gallery.mailchimp.com/1a1a/avatar/2a2a.png", |
| 29 |
"login_id": "88888888", |
| 30 |
"login_name": "[email protected]", |
| 31 |
"login_email": "[email protected]" |
| 32 |
}, |
| 33 |
"login_url": "https://login.mailchimp.com", |
| 34 |
"api_endpoint": "https://usX.api.mailchimp.com" |
| 35 |
}""", |
| 36 |
) |
| 37 |
|
| 38 |
def get_expected_to_str(self): |
| 39 |
return "[email protected]" |