| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.klaviyo.provider import KlaviyoProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class KlaviyoTests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = KlaviyoProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return MockedResponse( |
| 15 |
HTTPStatus.OK, |
| 16 |
"""{ |
| 17 |
"data": [ |
| 18 |
{ |
| 19 |
"type": "account", |
| 20 |
"id": "ACC123", |
| 21 |
"attributes": { |
| 22 |
"test_account": false, |
| 23 |
"contact_information": { |
| 24 |
"default_sender_name": "Acme", |
| 25 |
"default_sender_email": "[email protected]", |
| 26 |
"organization_name": "Acme", |
| 27 |
"street_address": { |
| 28 |
"address1": "1 Main St", |
| 29 |
"address2": "", |
| 30 |
"city": "Boston", |
| 31 |
"region": "MA", |
| 32 |
"country": "United States", |
| 33 |
"zip": "02118" |
| 34 |
} |
| 35 |
}, |
| 36 |
"industry": "Software / SaaS", |
| 37 |
"timezone": "US/Eastern", |
| 38 |
"preferred_currency": "USD", |
| 39 |
"public_api_key": "ABC123", |
| 40 |
"locale": "en-US" |
| 41 |
}, |
| 42 |
"links": { |
| 43 |
"self": "https://a.klaviyo.com/api/accounts/ACC123/" |
| 44 |
} |
| 45 |
} |
| 46 |
] |
| 47 |
}""", |
| 48 |
) |
| 49 |
|
| 50 |
def get_expected_to_str(self): |
| 51 |
return "Acme" |