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

« back to all changes in this revision

Viewing changes to social_core/tests/backends/test_nationbuilder.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 NationBuilderOAuth2Test(OAuth2Test):
 
7
    backend_path = 'social_core.backends.nationbuilder.NationBuilderOAuth2'
 
8
    user_data_url = 'https://foobar.nationbuilder.com/api/v1/people/me'
 
9
    expected_username = 'foobar'
 
10
    access_token_body = json.dumps({
 
11
        'access_token': 'foobar',
 
12
        'token_type': 'bearer',
 
13
        'created_at': 1422937981,
 
14
        'expires_in': 2592000
 
15
    })
 
16
    user_data_body = json.dumps({
 
17
        'person': {
 
18
            'twitter_followers_count': None,
 
19
            'last_name': 'Bar',
 
20
            'rule_violations_count': 0,
 
21
            'linkedin_id': None,
 
22
            'recruiter_id': None,
 
23
            'membership_expires_at': None,
 
24
            'donations_raised_count': 0,
 
25
            'last_contacted_at': None,
 
26
            'prefix': None,
 
27
            'profile_content_html': None,
 
28
            'email4': None,
 
29
            'email2': None,
 
30
            'availability': None,
 
31
            'occupation': None,
 
32
            'user_submitted_address': None,
 
33
            'could_vote_status': None,
 
34
            'state_upper_district': None,
 
35
            'salesforce_id': None,
 
36
            'van_id': None,
 
37
            'phone_time': None,
 
38
            'profile_content': None,
 
39
            'auto_import_id': None,
 
40
            'parent_id': None,
 
41
            'email4_is_bad': False,
 
42
            'twitter_updated_at': None,
 
43
            'email3_is_bad': False,
 
44
            'bio': None,
 
45
            'party_member': None,
 
46
            'unsubscribed_at': None,
 
47
            'fax_number': None,
 
48
            'last_contacted_by': None,
 
49
            'active_customer_expires_at': None,
 
50
            'federal_donotcall': False,
 
51
            'warnings_count': 0,
 
52
            'first_supporter_at': '2015-02-02T19:30:28-08:00',
 
53
            'previous_party': None,
 
54
            'donations_raised_amount_this_cycle_in_cents': 0,
 
55
            'call_status_name': None,
 
56
            'marital_status': None,
 
57
            'facebook_updated_at': None,
 
58
            'donations_count': 0,
 
59
            'note_updated_at': None,
 
60
            'closed_invoices_count': None,
 
61
            'profile_headline': None,
 
62
            'fire_district': None,
 
63
            'mobile_normalized': None,
 
64
            'import_id': None,
 
65
            'last_call_id': None,
 
66
            'donations_raised_amount_in_cents': 0,
 
67
            'facebook_address': None,
 
68
            'is_profile_private': False,
 
69
            'last_rule_violation_at': None,
 
70
            'sex': None,
 
71
            'full_name': 'Foo Bar',
 
72
            'last_donated_at': None,
 
73
            'donations_pledged_amount_in_cents': 0,
 
74
            'primary_email_id': 1,
 
75
            'media_market_name': None,
 
76
            'capital_amount_in_cents': 500,
 
77
            'datatrust_id': None,
 
78
            'precinct_code': None,
 
79
            'email3': None,
 
80
            'religion': None,
 
81
            'first_prospect_at': None,
 
82
            'judicial_district': None,
 
83
            'donations_count_this_cycle': 0,
 
84
            'work_address': None,
 
85
            'is_twitter_follower': False,
 
86
            'email1': 'foobar@gmail.com',
 
87
            'email': 'foobar@gmail.com',
 
88
            'contact_status_name': None,
 
89
            'mobile_opt_in': True,
 
90
            'twitter_description': None,
 
91
            'parent': None,
 
92
            'tags': [],
 
93
            'first_volunteer_at': None,
 
94
            'inferred_support_level': None,
 
95
            'banned_at': None,
 
96
            'first_invoice_at': None,
 
97
            'donations_raised_count_this_cycle': 0,
 
98
            'is_donor': False,
 
99
            'twitter_location': None,
 
100
            'email1_is_bad': False,
 
101
            'legal_name': None,
 
102
            'language': None,
 
103
            'registered_at': None,
 
104
            'call_status_id': None,
 
105
            'last_invoice_at': None,
 
106
            'school_sub_district': None,
 
107
            'village_district': None,
 
108
            'twitter_name': None,
 
109
            'membership_started_at': None,
 
110
            'subnations': [],
 
111
            'meetup_address': None,
 
112
            'author_id': None,
 
113
            'registered_address': None,
 
114
            'external_id': None,
 
115
            'twitter_login': None,
 
116
            'inferred_party': None,
 
117
            'spent_capital_amount_in_cents': 0,
 
118
            'suffix': None,
 
119
            'mailing_address': None,
 
120
            'is_leaderboardable': True,
 
121
            'twitter_website': None,
 
122
            'nbec_guid': None,
 
123
            'city_district': None,
 
124
            'church': None,
 
125
            'is_profile_searchable': True,
 
126
            'employer': None,
 
127
            'is_fundraiser': False,
 
128
            'email_opt_in': True,
 
129
            'recruits_count': 0,
 
130
            'email2_is_bad': False,
 
131
            'county_district': None,
 
132
            'recruiter': None,
 
133
            'twitter_friends_count': None,
 
134
            'facebook_username': None,
 
135
            'active_customer_started_at': None,
 
136
            'pf_strat_id': None,
 
137
            'locale': None,
 
138
            'twitter_address': None,
 
139
            'is_supporter': True,
 
140
            'do_not_call': False,
 
141
            'profile_image_url_ssl': 'https://d3n8a8pro7vhmx.cloudfront.net'
 
142
                                     '/assets/icons/buddy.png',
 
143
            'invoices_amount_in_cents': None,
 
144
            'username': None,
 
145
            'donations_amount_in_cents': 0,
 
146
            'is_volunteer': False,
 
147
            'civicrm_id': None,
 
148
            'supranational_district': None,
 
149
            'precinct_name': None,
 
150
            'invoice_payments_amount_in_cents': None,
 
151
            'work_phone_number': None,
 
152
            'phone': '213.394.4623',
 
153
            'received_capital_amount_in_cents': 500,
 
154
            'primary_address': None,
 
155
            'is_possible_duplicate': False,
 
156
            'invoice_payments_referred_amount_in_cents': None,
 
157
            'donations_amount_this_cycle_in_cents': 0,
 
158
            'priority_level': None,
 
159
            'first_fundraised_at': None,
 
160
            'phone_normalized': '2133944623',
 
161
            'rnc_regid': None,
 
162
            'twitter_id': None,
 
163
            'birthdate': None,
 
164
            'mobile': None,
 
165
            'federal_district': None,
 
166
            'donations_to_raise_amount_in_cents': 0,
 
167
            'support_probability_score': None,
 
168
            'invoices_count': None,
 
169
            'nbec_precinct_code': None,
 
170
            'website': None,
 
171
            'closed_invoices_amount_in_cents': None,
 
172
            'home_address': None,
 
173
            'school_district': None,
 
174
            'support_level': None,
 
175
            'demo': None,
 
176
            'children_count': 0,
 
177
            'updated_at': '2015-02-02T19:30:28-08:00',
 
178
            'membership_level_name': None,
 
179
            'billing_address': None,
 
180
            'is_ignore_donation_limits': False,
 
181
            'signup_type': 0,
 
182
            'precinct_id': None,
 
183
            'rnc_id': None,
 
184
            'id': 2,
 
185
            'ethnicity': None,
 
186
            'is_survey_question_private': False,
 
187
            'middle_name': None,
 
188
            'author': None,
 
189
            'last_fundraised_at': None,
 
190
            'state_file_id': None,
 
191
            'note': None,
 
192
            'submitted_address': None,
 
193
            'support_level_changed_at': None,
 
194
            'party': None,
 
195
            'contact_status_id': None,
 
196
            'outstanding_invoices_amount_in_cents': None,
 
197
            'page_slug': None,
 
198
            'outstanding_invoices_count': None,
 
199
            'first_recruited_at': None,
 
200
            'county_file_id': None,
 
201
            'first_name': 'Foo',
 
202
            'facebook_profile_url': None,
 
203
            'city_sub_district': None,
 
204
            'has_facebook': False,
 
205
            'is_deceased': False,
 
206
            'labour_region': None,
 
207
            'state_lower_district': None,
 
208
            'dw_id': None,
 
209
            'created_at': '2015-02-02T19:30:28-08:00',
 
210
            'is_prospect': False,
 
211
            'priority_level_changed_at': None,
 
212
            'is_mobile_bad': False,
 
213
            'overdue_invoices_count': None,
 
214
            'ngp_id': None,
 
215
            'do_not_contact': False,
 
216
            'first_donated_at': None,
 
217
            'turnout_probability_score': None
 
218
        },
 
219
        'precinct': None
 
220
    })
 
221
 
 
222
    def test_login(self):
 
223
        self.strategy.set_settings({
 
224
            'SOCIAL_AUTH_NATIONBUILDER_SLUG': 'foobar'
 
225
            })
 
226
        self.do_login()
 
227
 
 
228
    def test_partial_pipeline(self):
 
229
        self.strategy.set_settings({
 
230
            'SOCIAL_AUTH_NATIONBUILDER_SLUG': 'foobar'
 
231
            })
 
232
        self.do_partial_pipeline()