Debian Codegraph @

tests/apps/socialaccount/providers/foursquare/tests.py

raw
1 from http import HTTPStatus
2
3 from django.test import TestCase
4
5 from allauth.socialaccount.providers.foursquare.provider import FoursquareProvider
6 from tests.apps.socialaccount.base import OAuth2TestsMixin
7 from tests.mocking import MockedResponse
8
9
10 class FoursquareTests(OAuth2TestsMixin, TestCase):
11 provider_id = FoursquareProvider.id
12
13 def get_mocked_response(self):
14 return MockedResponse(
15 HTTPStatus.OK,
16 """
17 {"notifications": [{"item": {"unreadCount": 0}, "type": "notificationTray"}],
18 "meta": {"code": 200},
19 "response": {
20 "user": {
21 "photo": {
22 "prefix": "https://irs0.4sqi.net/img/user/", "suffix": "/blank_boy.png"},
23 "pings": false,
24 "homeCity": "Athens, ESYE31",
25 "id": "76077726",
26 "badges": {"count": 0, "items": []},
27 "referralId": "u-76077726",
28 "friends":
29 {
30 "count": 0,
31 "groups": [{"count": 0, "items": [], "type": "friends",
32 "name": "Mutual friends"}, {"count": 0, "items": [], "type": "others",
33 "name": "Other friends"}]
34 },
35 "createdAt": 1389624445,
36 "tips": {"count": 0},
37 "type": "user",
38 "bio": "",
39 "relationship": "self",
40 "lists":
41 {
42 "count": 1,
43 "groups": [{"count": 1, "items": [{"description": "",
44 "collaborative": false, "url": "/user/76077726/list/todos", "editable": false,
45 "listItems": {"count": 0}, "id": "76077726/todos", "followers": {"count": 0},
46 "user": {"gender": "male",
47 "firstName": "\u03a1\u03c9\u03bc\u03b1\u03bd\u03cc\u03c2",
48 "relationship": "self", "photo": {"prefix": "https://irs0.4sqi.net/img/user/",
49 "suffix": "/blank_boy.png"},
50 "lastName": "\u03a4\u03c3\u03bf\u03c5\u03c1\u03bf\u03c0\u03bb\u03ae\u03c2",
51 "id": "76077726"}, "public": false,
52 "canonicalUrl": "https://foursquare.com/user/76077726/list/todos",
53 "name": "My to-do list"}], "type": "created"}, {"count": 0, "items": [],
54 "type": "followed"}]
55 },
56 "photos": {"count": 0, "items": []},
57 "checkinPings": "off",
58 "scores": {"max": 0, "checkinsCount": 0, "goal": 50, "recent": 0},
59 "checkins": {"count": 0, "items": []},
60 "firstName": "\u03a1\u03c9\u03bc\u03b1\u03bd\u03cc\u03c2",
61 "gender": "male",
62 "contact": {"email": "[email protected]"},
63 "lastName": "\u03a4\u03c3\u03bf\u03c5\u03c1\u03bf\u03c0\u03bb\u03ae\u03c2",
64 "following": {"count": 0, "groups": [{"count": 0, "items": [],
65 "type": "following", "name": "Mutual following"}, {"count": 0, "items": [],
66 "type": "others", "name": "Other following"}]},
67 "requests": {"count": 0}, "mayorships": {"count": 0, "items": []}}
68 }
69 }
70 """,
71 )
72
73 def get_expected_to_str(self):
74 return "[email protected]"