3
from .oauth import OAuth2Test
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,
16
user_data_body = json.dumps({
18
'twitter_followers_count': None,
20
'rule_violations_count': 0,
23
'membership_expires_at': None,
24
'donations_raised_count': 0,
25
'last_contacted_at': None,
27
'profile_content_html': None,
32
'user_submitted_address': None,
33
'could_vote_status': None,
34
'state_upper_district': None,
35
'salesforce_id': None,
38
'profile_content': None,
39
'auto_import_id': None,
41
'email4_is_bad': False,
42
'twitter_updated_at': None,
43
'email3_is_bad': False,
46
'unsubscribed_at': None,
48
'last_contacted_by': None,
49
'active_customer_expires_at': None,
50
'federal_donotcall': False,
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,
59
'note_updated_at': None,
60
'closed_invoices_count': None,
61
'profile_headline': None,
62
'fire_district': None,
63
'mobile_normalized': None,
66
'donations_raised_amount_in_cents': 0,
67
'facebook_address': None,
68
'is_profile_private': False,
69
'last_rule_violation_at': 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,
78
'precinct_code': None,
81
'first_prospect_at': None,
82
'judicial_district': None,
83
'donations_count_this_cycle': 0,
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,
93
'first_volunteer_at': None,
94
'inferred_support_level': None,
96
'first_invoice_at': None,
97
'donations_raised_count_this_cycle': 0,
99
'twitter_location': None,
100
'email1_is_bad': False,
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,
111
'meetup_address': None,
113
'registered_address': None,
115
'twitter_login': None,
116
'inferred_party': None,
117
'spent_capital_amount_in_cents': 0,
119
'mailing_address': None,
120
'is_leaderboardable': True,
121
'twitter_website': None,
123
'city_district': None,
125
'is_profile_searchable': True,
127
'is_fundraiser': False,
128
'email_opt_in': True,
130
'email2_is_bad': False,
131
'county_district': None,
133
'twitter_friends_count': None,
134
'facebook_username': None,
135
'active_customer_started_at': 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,
145
'donations_amount_in_cents': 0,
146
'is_volunteer': False,
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',
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,
171
'closed_invoices_amount_in_cents': None,
172
'home_address': None,
173
'school_district': None,
174
'support_level': None,
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,
186
'is_survey_question_private': False,
189
'last_fundraised_at': None,
190
'state_file_id': None,
192
'submitted_address': None,
193
'support_level_changed_at': None,
195
'contact_status_id': None,
196
'outstanding_invoices_amount_in_cents': None,
198
'outstanding_invoices_count': None,
199
'first_recruited_at': None,
200
'county_file_id': None,
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,
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,
215
'do_not_contact': False,
216
'first_donated_at': None,
217
'turnout_probability_score': None
222
def test_login(self):
223
self.strategy.set_settings({
224
'SOCIAL_AUTH_NATIONBUILDER_SLUG': 'foobar'
228
def test_partial_pipeline(self):
229
self.strategy.set_settings({
230
'SOCIAL_AUTH_NATIONBUILDER_SLUG': 'foobar'
232
self.do_partial_pipeline()