Debian Codegraph @

tests/apps/socialaccount/providers/kakao/tests.py

raw
1 from http import HTTPStatus
2
3 from django.test import TestCase
4
5 from allauth.socialaccount.providers.kakao.provider import KakaoProvider
6 from tests.apps.socialaccount.base import OAuth2TestsMixin
7 from tests.mocking import MockedResponse
8
9
10 class KakaoTests(OAuth2TestsMixin, TestCase):
11 provider_id = KakaoProvider.id
12
13 kakao_data = """
14 {
15 "id": 123456789,
16 "connected_at": "2022-04-11T01:45:28Z",
17 "kakao_account": {
18 "profile_nickname_needs_agreement": false,
19 "profile_image_needs_agreement": false,
20 "profile": {
21 "nickname": "홍길동",
22 "thumbnail_image_url": "http://yyy.kakao.com/.../img_110x110.jpg",
23 "profile_image_url": "http://yyy.kakao.com/dn/.../img_640x640.jpg",
24 "is_default_image":false,
25 "is_default_nickname": false
26 },
27 "name_needs_agreement":false,
28 "name":"홍길동",
29 "email_needs_agreement":false,
30 "is_email_valid": true,
31 "is_email_verified": true,
32 "email": "[email protected]",
33 "age_range_needs_agreement":false,
34 "age_range":"20~29",
35 "birthyear_needs_agreement": false,
36 "birthyear": "2002",
37 "birthday_needs_agreement":false,
38 "birthday":"1130",
39 "birthday_type":"SOLAR",
40 "gender_needs_agreement":false,
41 "gender":"female",
42 "phone_number_needs_agreement": false,
43 "phone_number": "+82 010-1234-5678",
44 "ci_needs_agreement": false,
45 "ci": "CI",
46 "ci_authenticated_at": "2019-03-11T11:25:22Z"
47 },
48 "properties":{
49 "CUSTOM_PROPERTY_KEY": "CUSTOM_PROPERTY_VALUE"
50 },
51 "for_partner": {
52 "uuid": "UUID"
53 }
54 }
55 """
56
57 def get_expected_to_str(self):
58 return "[email protected]"
59
60 def get_mocked_response(self, data=None):
61 if data is None:
62 data = self.kakao_data
63 return MockedResponse(HTTPStatus.OK, data)