Debian Codegraph @

tests/apps/socialaccount/providers/dingtalk/tests.py

raw
1 from http import HTTPStatus
2
3 from django.test import TestCase
4
5 from allauth.socialaccount.providers.dingtalk.provider import DingTalkProvider
6 from tests.apps.socialaccount.base import OAuth2TestsMixin
7 from tests.mocking import MockedResponse
8
9
10 class DingTalkTests(OAuth2TestsMixin, TestCase):
11 provider_id = DingTalkProvider.id
12
13 def get_mocked_response(self):
14 return MockedResponse(
15 HTTPStatus.OK,
16 """{
17 "nick": "aiden",
18 "unionId": "hTaCSb1nM4RXii6jaQvHZqQiEiE",
19 "avatarUrl": "https://static-legacy.dingtalk.com/media/lADPDg7mViaksW3NBJPNBJI_1170_1171.jpg",
20 "openId": "ELdCPlk0V2LodZHx3n0p5AiEiE"
21 }""",
22 )
23
24 def get_login_response_json(self, with_refresh_token=True):
25 return """{
26 "accessToken": "testac",
27 "expireIn": "3600",
28 "refreshToken": "testrf"
29 }"""
30
31 def get_expected_to_str(self):
32 return "aiden"