~ubuntu-branches/debian/sid/social-auth-core/sid

« back to all changes in this revision

Viewing changes to social_core/tests/backends/test_patreon.py

  • Committer: Package Import Robot
  • Author(s): Andre Bianchi
  • Date: 2018-02-22 19:49:12 UTC
  • Revision ID: package-import@ubuntu.com-20180222194912-4lqv8mlhnqc4ncd3
Tags: upstream-1.7.0
ImportĀ upstreamĀ versionĀ 1.7.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
import json
 
2
 
 
3
from .oauth import OAuth2Test
 
4
 
 
5
 
 
6
class PatreonOAuth2Test(OAuth2Test):
 
7
    backend_path = 'social_core.backends.patreon.PatreonOAuth2'
 
8
    user_data_url = 'https://api.patreon.com/oauth2/api/current_user'
 
9
    expected_username = 'JohnInterwebs'
 
10
    access_token_body = json.dumps({
 
11
        'access_token': 'foobar',
 
12
        'token_type': 'bearer',
 
13
    })
 
14
    user_data_body = json.dumps({
 
15
        "data": {
 
16
            "relationships": {
 
17
                "pledges": {
 
18
                    "data": [{
 
19
                        "type": "pledge", "id": "123456"
 
20
                    }]
 
21
                }
 
22
            },
 
23
            "attributes": {
 
24
                "last_name": "Interwebs",
 
25
                "is_suspended": False,
 
26
                "has_password": True,
 
27
                "full_name": "John Interwebs",
 
28
                "is_nuked": False,
 
29
                "first_name": "John",
 
30
                "social_connections": {
 
31
                    "spotify": None,
 
32
                    "discord": None,
 
33
                    "twitter": None,
 
34
                    "youtube": None,
 
35
                    "facebook": None,
 
36
                    "deviantart": None,
 
37
                    "twitch": None
 
38
                },
 
39
                "twitter": None,
 
40
                "is_email_verified": True,
 
41
                "facebook_id": None,
 
42
                "email": "john@example.com",
 
43
                "facebook": None,
 
44
                "thumb_url": "https://c8.patreon.com/100/123456",
 
45
                "vanity": None,
 
46
                "about": None,
 
47
                "is_deleted": False,
 
48
                "created": "2017-05-05T05:16:34+00:00",
 
49
                "url": "https://www.patreon.com/user?u=123456",
 
50
                "gender": 0,
 
51
                "youtube": None,
 
52
                "discord_id": None,
 
53
                "image_url": "https://c8.patreon.com/400/123456",
 
54
                "twitch": None
 
55
            },
 
56
            "type": "user",
 
57
            "id": "123456"
 
58
        }
 
59
    })
 
60
 
 
61
    def test_login(self):
 
62
        self.do_login()
 
63
 
 
64
    def test_partial_pipeline(self):
 
65
        self.do_partial_pipeline()