Debian Codegraph @

tests/apps/socialaccount/providers/untappd/tests.py

raw
1 from http import HTTPStatus
2
3 from django.test import TestCase
4
5 from allauth.socialaccount.providers.untappd.provider import UntappdProvider
6 from tests.apps.socialaccount.base import OAuth2TestsMixin
7 from tests.mocking import MockedResponse
8
9
10 class UntappdTests(OAuth2TestsMixin, TestCase):
11 provider_id = UntappdProvider.id
12
13 def get_login_response_json(self, with_refresh_token=True):
14 return """
15 {
16 "meta": {
17 "http_code": 200
18 },
19 "response": {
20 "access_token": "testac"
21 }
22 }"""
23
24 def get_mocked_response(self):
25 return MockedResponse(
26 HTTPStatus.OK,
27 """
28 {
29 "meta":{
30 "code":200,
31 "response_time":{
32 "time":0.29,
33 "measure":"seconds"
34 },
35 "init_time":{
36 "time":0.011,
37 "measure":"seconds"
38 }
39 },
40 "notifications":{
41 "type":"notifications",
42 "unread_count":{
43 "comments":0,
44 "toasts":0,
45 "friends":0,
46 "messages":0,
47 "news":0
48 }
49 },
50 "response":{
51 "user":{
52 "uid":123456,
53 "id":123456,
54 "user_name":"groovecoder",
55 "first_name":"",
56 "last_name":"",
57 "user_avatar":"https:\\/\\/gravatar.com\\/avatar\\/ec25d046746de3be33779256f6957d8f?size=100&d=https%3A%2F%2Funtappd.akamaized.net%2Fsite%2Fassets%2Fimages%2Fdefault_avatar_v2.jpg%3Fv%3D1",
58 "user_avatar_hd":"https:\\/\\/gravatar.com\\/avatar\\/ec25d046746de3be33779256f6957d8f?size=125&d=https%3A%2F%2Funtappd.akamaized.net%2Fsite%2Fassets%2Fimages%2Fdefault_avatar_v2.jpg%3Fv%3D1",
59 "user_cover_photo":"https:\\/\\/untappd.akamaized.net\\/site\\/assets\\/v3\\/images\\/cover_default.jpg",
60 "user_cover_photo_offset":0,
61 "is_private":0,
62 "location":"Testville",
63 "url":"",
64 "bio":"",
65 "is_supporter":0,
66 "relationship":"self",
67 "untappd_url":"http:\\/\\/untappd.com\\/user\\/testuser",
68 "account_type":"user",
69 "stats":{
70 "total_badges":43,
71 "total_friends":43,
72 "total_checkins":73,
73 "total_beers":61,
74 "total_created_beers":1,
75 "total_followings":9,
76 "total_photos":31
77 },
78 "recent_brews":{},
79 "checkins":{},
80 "media":{},
81 "contact":{},
82 "date_joined":"Tue, 11 Dec 2012 14:27:53 +0000",
83 "settings":{
84 "badge":{
85 "badges_to_facebook":1,
86 "badges_to_twitter":1
87 },
88 "checkin":{
89 "checkin_to_facebook":0,
90 "checkin_to_twitter":0,
91 "checkin_to_foursquare":0
92 },
93 "navigation":{
94 "default_to_checkin":0
95 },
96 "email_address":"[email protected]"
97 }
98 }
99 }
100 }
101 """,
102 )
103
104 def get_expected_to_str(self):
105 return "groovecoder"