| 1 |
from http import HTTPStatus |
| 2 |
|
| 3 |
from django.test import TestCase |
| 4 |
|
| 5 |
from allauth.socialaccount.providers.slack.provider import SlackProvider |
| 6 |
from tests.apps.socialaccount.base import OAuth2TestsMixin |
| 7 |
from tests.mocking import MockedResponse |
| 8 |
|
| 9 |
|
| 10 |
class SlackOAuth2Tests(OAuth2TestsMixin, TestCase): |
| 11 |
provider_id = SlackProvider.id |
| 12 |
|
| 13 |
def get_mocked_response(self): |
| 14 |
return MockedResponse( |
| 15 |
HTTPStatus.OK, |
| 16 |
"""{ |
| 17 |
"ok": true, |
| 18 |
"sub": "U0R7JM", |
| 19 |
"https://slack.com/user_id": "U0R7JM", |
| 20 |
"https://slack.com/team_id": "T0R7GR", |
| 21 |
"email": "[email protected]", |
| 22 |
"email_verified": true, |
| 23 |
"date_email_verified": 1622128723, |
| 24 |
"name": "krane", |
| 25 |
"picture": "https://secure.gravatar.com/....png", |
| 26 |
"given_name": "Bront", |
| 27 |
"family_name": "Labradoodle", |
| 28 |
"locale": "en-US", |
| 29 |
"https://slack.com/team_name": "kraneflannel", |
| 30 |
"https://slack.com/team_domain": "kraneflannel" |
| 31 |
}""", |
| 32 |
) # noqa |
| 33 |
|
| 34 |
def get_expected_to_str(self): |
| 35 |
return "[email protected]" |