Debian Codegraph @

tests/apps/socialaccount/providers/stackexchange/tests.py

raw
1 from http import HTTPStatus
2
3 from django.test import TestCase
4
5 from allauth.socialaccount.providers.stackexchange.provider import StackExchangeProvider
6 from tests.apps.socialaccount.base import OAuth2TestsMixin
7 from tests.mocking import MockedResponse
8
9
10 class StackExchangeTests(OAuth2TestsMixin, TestCase):
11 provider_id = StackExchangeProvider.id
12
13 def get_mocked_response(self):
14 return MockedResponse(
15 HTTPStatus.OK,
16 """
17 {
18 "has_more": false,
19 "items": [
20 {
21 "is_employee": false,
22 "last_access_date": 1356200390,
23 "display_name": "pennersr",
24 "account_id": 291652,
25 "badge_counts": {
26 "bronze": 2,
27 "silver": 2,
28 "gold": 0
29 },
30 "last_modified_date": 1356199552,
31 "profile_image":
32 "http://www.gravatar.com/avatar/053d648486d567d3143d6bad8df8cfeb?d=identicon&r=PG",
33 "user_type": "registered",
34 "creation_date": 1296223711,
35 "reputation_change_quarter": 148,
36 "reputation_change_year": 378,
37 "reputation": 504,
38 "link": "http://stackoverflow.com/users/593944/pennersr",
39 "reputation_change_week": 0,
40 "user_id": 593944,
41 "reputation_change_month": 10,
42 "reputation_change_day": 0
43 }
44 ],
45 "quota_max": 10000,
46 "quota_remaining": 9999
47 }""",
48 ) # noqa
49
50 def get_expected_to_str(self):
51 return "pennersr"