Debian Codegraph @

tests/apps/socialaccount/providers/dwolla/tests.py

raw
1 from http import HTTPStatus
2
3 from django.test import TestCase
4
5 from allauth.socialaccount.providers.dwolla.provider import DwollaProvider
6 from tests.apps.socialaccount.base import OAuth2TestsMixin
7 from tests.mocking import MockedResponse
8
9
10 class DwollaTests(OAuth2TestsMixin, TestCase):
11 provider_id = DwollaProvider.id
12
13 def get_mocked_response(self):
14 return MockedResponse(
15 HTTPStatus.OK,
16 """{
17 "id": "123",
18 "_links":{"account":{"href":"http://localhost"}},
19 "name":"John Doe"
20 }""",
21 )
22
23 def get_login_response_json(self, with_refresh_token=True):
24 rt = ""
25 if with_refresh_token:
26 rt = ',"refresh_token": "testrf"'
27 return (
28 """{
29 "uid":"weibo",
30 "access_token":"testac",
31 "_links":{"account":{"href":"http://localhost"}}
32 %s }"""
33 % rt
34 )
35
36 def get_expected_to_str(self):
37 return "John Doe"