Debian Codegraph @

tests/apps/socialaccount/providers/digitalocean/tests.py

raw
1 from http import HTTPStatus
2
3 from django.test import TestCase
4
5 from allauth.socialaccount.providers.digitalocean.provider import DigitalOceanProvider
6 from tests.apps.socialaccount.base import OAuth2TestsMixin
7 from tests.mocking import MockedResponse
8
9
10 class DigitalOceanTests(OAuth2TestsMixin, TestCase):
11 provider_id = DigitalOceanProvider.id
12
13 def get_mocked_response(self):
14 return MockedResponse(
15 HTTPStatus.OK,
16 """
17 {
18 "account": {
19 "droplet_limit": 25,
20 "floating_ip_limit": 5,
21 "email": "[email protected]",
22 "uuid": "b6fr89dbf6d9156cace5f3c78dc9851d957381ef",
23 "email_verified": true,
24 "status": "active",
25 "status_message": ""
26 }
27 }
28 """,
29 )
30
31 def get_login_response_json(self, with_refresh_token=True):
32 return """
33 {
34 "access_token": "testac",
35 "token_type": "bearer",
36 "expires_in": 2592000,
37 "refresh_token": "00a3aae641658d",
38 "scope": "read write",
39 "info": {
40 "name": "Sammy the Shark",
41 "email":"[email protected]",
42 "uuid":"b6fr89dbf6d9156cace5f3c78dc9851d957381ef"
43 }
44 }"""
45
46 def get_expected_to_str(self):
47 return "[email protected]"