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

« back to all changes in this revision

Viewing changes to social_core/tests/backends/test_mapmyfitness.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 MapMyFitnessOAuth2Test(OAuth2Test):
 
7
    backend_path = 'social_core.backends.mapmyfitness.MapMyFitnessOAuth2'
 
8
    user_data_url = 'https://oauth2-api.mapmyapi.com/v7.0/user/self/'
 
9
    expected_username = 'FredFlinstone'
 
10
    access_token_body = json.dumps({
 
11
        'access_token': 'foobar',
 
12
        'token_type': 'Bearer',
 
13
        'expires_in': 4000000,
 
14
        'refresh_token': 'bambaz',
 
15
        'scope': 'read'
 
16
    })
 
17
    user_data_body = json.dumps({
 
18
        'last_name': 'Flinstone',
 
19
        'weight': 91.17206637,
 
20
        'communication': {
 
21
            'promotions': True,
 
22
            'newsletter': True,
 
23
            'system_messages': True
 
24
        },
 
25
        'height': 1.778,
 
26
        'token_type': 'Bearer',
 
27
        'id': 112233,
 
28
        'date_joined': '2011-08-26T06:06:19+00:00',
 
29
        'first_name': 'Fred',
 
30
        'display_name': 'Fred Flinstone',
 
31
        'display_measurement_system': 'imperial',
 
32
        'expires_in': 4000000,
 
33
        '_links': {
 
34
            'stats': [
 
35
                {
 
36
                    'href': '/v7.0/user_stats/112233/?'
 
37
                            'aggregate_by_period=month',
 
38
                    'id': '112233',
 
39
                    'name': 'month'
 
40
                },
 
41
                {
 
42
                    'href': '/v7.0/user_stats/112233/?'
 
43
                            'aggregate_by_period=year',
 
44
                    'id': '112233',
 
45
                    'name': 'year'
 
46
                },
 
47
                {
 
48
                    'href': '/v7.0/user_stats/112233/?aggregate_by_period=day',
 
49
                    'id': '112233',
 
50
                    'name': 'day'
 
51
                },
 
52
                {
 
53
                    'href': '/v7.0/user_stats/112233/?'
 
54
                            'aggregate_by_period=week',
 
55
                    'id': '112233',
 
56
                    'name': 'week'
 
57
                },
 
58
                {
 
59
                    'href': '/v7.0/user_stats/112233/?'
 
60
                            'aggregate_by_period=lifetime',
 
61
                    'id': '112233',
 
62
                    'name': 'lifetime'
 
63
                }
 
64
            ],
 
65
            'friendships': [
 
66
                {
 
67
                    'href': '/v7.0/friendship/?from_user=112233'
 
68
                }
 
69
            ],
 
70
            'privacy': [
 
71
                {
 
72
                    'href': '/v7.0/privacy_option/3/',
 
73
                    'id': '3',
 
74
                    'name': 'profile'
 
75
                },
 
76
                {
 
77
                    'href': '/v7.0/privacy_option/3/',
 
78
                    'id': '3',
 
79
                    'name': 'workout'
 
80
                },
 
81
                {
 
82
                    'href': '/v7.0/privacy_option/3/',
 
83
                    'id': '3',
 
84
                    'name': 'activity_feed'
 
85
                },
 
86
                {
 
87
                    'href': '/v7.0/privacy_option/1/',
 
88
                    'id': '1',
 
89
                    'name': 'food_log'
 
90
                },
 
91
                {
 
92
                    'href': '/v7.0/privacy_option/3/',
 
93
                    'id': '3',
 
94
                    'name': 'email_search'
 
95
                },
 
96
                {
 
97
                    'href': '/v7.0/privacy_option/3/',
 
98
                    'id': '3',
 
99
                    'name': 'route'
 
100
                }
 
101
            ],
 
102
            'image': [
 
103
                {
 
104
                    'href': '/v7.0/user_profile_photo/112233/',
 
105
                    'id': '112233',
 
106
                    'name': 'user_profile_photo'
 
107
                }
 
108
            ],
 
109
            'documentation': [
 
110
                {
 
111
                    'href': 'https://www.mapmyapi.com/docs/User'
 
112
                }
 
113
            ],
 
114
            'workouts': [
 
115
                {
 
116
                    'href': '/v7.0/workout/?user=112233&'
 
117
                            'order_by=-start_datetime'
 
118
                }
 
119
            ],
 
120
            'deactivation': [
 
121
                {
 
122
                    'href': '/v7.0/user_deactivation/'
 
123
                }
 
124
            ],
 
125
            'self': [
 
126
                {
 
127
                    'href': '/v7.0/user/112233/',
 
128
                    'id': '112233'
 
129
                }
 
130
            ]
 
131
        },
 
132
        'location': {
 
133
            'country': 'US',
 
134
            'region': 'NC',
 
135
            'locality': 'Bedrock',
 
136
            'address': '150 Dinosaur Ln'
 
137
        },
 
138
        'last_login': '2014-02-23T22:36:52+00:00',
 
139
        'email': 'fredflinstone@gmail.com',
 
140
        'username': 'FredFlinstone',
 
141
        'sharing': {
 
142
            'twitter': False,
 
143
            'facebook': False
 
144
        },
 
145
        'scope': 'read',
 
146
        'refresh_token': 'bambaz',
 
147
        'last_initial': 'S.',
 
148
        'access_token': 'foobar',
 
149
        'gender': 'M',
 
150
        'time_zone': 'America/Denver',
 
151
        'birthdate': '1983-04-15'
 
152
    })
 
153
 
 
154
    def test_login(self):
 
155
        self.do_login()
 
156
 
 
157
    def test_partial_pipeline(self):
 
158
        self.do_partial_pipeline()