Debian Codegraph @

tests/apps/socialaccount/providers/lichess/tests.py

raw
1 from http import HTTPStatus
2
3 from django.test import TestCase
4
5 from allauth.socialaccount.providers.lichess.provider import LichessProvider
6 from tests.apps.socialaccount.base import OAuth2TestsMixin
7 from tests.mocking import MockedResponse
8
9
10 class LichessTests(OAuth2TestsMixin, TestCase):
11 provider_id = LichessProvider.id
12
13 def get_mocked_response(self):
14 return [
15 MockedResponse(
16 HTTPStatus.OK,
17 """
18 {
19 "id": "george",
20 "url": "https://lichess.org/@/george",
21 "count": {
22 "ai": 0,
23 "me": 0,
24 "all": 0,
25 "win": 0,
26 "draw": 0,
27 "loss": 0,
28 "winH": 0,
29 "drawH": 0,
30 "lossH": 0,
31 "rated": 0,
32 "import": 0,
33 "playing": 0,
34 "bookmark": 0
35 },
36 "perfs": {
37 "blitz": {
38 "rd": 500,
39 "prog": 0,
40 "prov": true,
41 "games": 0,
42 "rating": 1500
43 },
44 "rapid": {
45 "rd": 500,
46 "prog": 0,
47 "prov": true,
48 "games": 0,
49 "rating": 1500
50 },
51 "bullet": {
52 "rd": 500,
53 "prog": 0,
54 "prov": true,
55 "games": 0,
56 "rating": 1500
57 },
58 "classical": {
59 "rd": 500,
60 "prog": 0,
61 "prov": true,
62 "games": 0,
63 "rating": 1500
64 },
65 "correspondence": {
66 "rd": 500,
67 "prog": 0,
68 "prov": true,
69 "games": 0,
70 "rating": 1500
71 }
72 },
73 "seenAt": 1713837454330,
74 "blocking": false,
75 "playTime": {
76 "tv": 0,
77 "total": 0
78 },
79 "username": "george",
80 "createdAt": 1713837409417,
81 "following": false,
82 "followable": true,
83 "followsYou": false
84 }
85 """,
86 ),
87 MockedResponse(HTTPStatus.OK, """{"email":"[email protected]"}"""),
88 ]
89
90 def get_expected_to_str(self):
91 return "george"