@@ -39,95 +39,115 @@ def _call(*args, **kwargs):
3939 return _call
4040
4141
42- test_user_obj = {
43- "type" : "user" ,
44- "id" : "aaaaaaaaaaaaaaaaaaaaaaaa" ,
45- "user_id" : 'id-from-customers-app' ,
46- "email" : 'bob@example.com' ,
47- "name" : "Joe Schmoe" ,
48- "avatar" : {
49- "type" : "avatar" ,
50- "image_url" : "https://graph.facebook.com/1/picture?width=24&height=24"
51- },
52- "app_id" : "the-app-id" ,
53- "created_at" : 1323422442 ,
54- "custom_attributes" : {"a" : "b" , "b" : 2 },
55- "companies" : {
56- "type" : "company.list" ,
57- "companies" : [
58- {
59- "type" : "company" ,
60- "company_id" : "123" ,
61- "id" : "bbbbbbbbbbbbbbbbbbbbbbbb" ,
62- "app_id" : "the-app-id" ,
63- "name" : "Company 1" ,
64- "remote_created_at" : 1390936440 ,
65- "created_at" : 1401970114 ,
66- "updated_at" : 1401970114 ,
67- "last_request_at" : 1401970113 ,
68- "monthly_spend" : 0 ,
69- "session_count" : 0 ,
70- "user_count" : 1 ,
71- "tag_ids" : [],
72- "custom_attributes" : {
73- "category" : "Tech"
42+ def test_user (email = "bob@example.com" ):
43+ return {
44+ "type" : "user" ,
45+ "id" : "aaaaaaaaaaaaaaaaaaaaaaaa" ,
46+ "user_id" : 'id-from-customers-app' ,
47+ "email" : email ,
48+ "name" : "Joe Schmoe" ,
49+ "avatar" : {
50+ "type" : "avatar" ,
51+ "image_url" : "https://graph.facebook.com/1/picture?width=24&height=24"
52+ },
53+ "app_id" : "the-app-id" ,
54+ "created_at" : 1323422442 ,
55+ "custom_attributes" : {"a" : "b" , "b" : 2 },
56+ "companies" : {
57+ "type" : "company.list" ,
58+ "companies" : [
59+ {
60+ "type" : "company" ,
61+ "company_id" : "123" ,
62+ "id" : "bbbbbbbbbbbbbbbbbbbbbbbb" ,
63+ "app_id" : "the-app-id" ,
64+ "name" : "Company 1" ,
65+ "remote_created_at" : 1390936440 ,
66+ "created_at" : 1401970114 ,
67+ "updated_at" : 1401970114 ,
68+ "last_request_at" : 1401970113 ,
69+ "monthly_spend" : 0 ,
70+ "session_count" : 0 ,
71+ "user_count" : 1 ,
72+ "tag_ids" : [],
73+ "custom_attributes" : {
74+ "category" : "Tech"
75+ }
7476 }
75- }
76- ]
77- } ,
78- "session_count " : 123 ,
79- "unsubscribed_from_emails " : True ,
80- "last_request_at " : 1401970113 ,
81- "created_at " : 1401970114 ,
82- "remote_created_at " : 1393613864 ,
83- "updated_at " : 1401970114 ,
84- "user_agent_data" : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11" ,
85- "social_profiles " : {
86- "type " : "social_profile.list" ,
87- "social_profiles" : [
88- {
89- "type " : "social_profile " ,
90- "name " : "twitter" ,
91- "url " : "http://twitter.com/ abc" ,
92- "username " : "abc" ,
93- "id" : None
94- },
95- {
96- "type " : "social_profile " ,
97- "name " : "twitter " ,
98- "username " : "abc2" ,
99- "url " : "http://twitter.com/abc2" ,
100- "id" : None
101- },
102- {
103- "type " : "social_profile " ,
104- "name " : "facebook" ,
105- "url " : "http://facebook.com/ abc" ,
106- "username " : "abc" ,
107- "id" : "1234242"
108- },
109- {
110- "type " : "social_profile " ,
111- "name " : "quora " ,
112- "url " : "http://facebook.com/ abc" ,
113- "username " : "abc" ,
114- "id" : "1234242"
115- }
116- ]
117- },
118- "location_data " : {
119- "type " : "location_data" ,
120- "city_name " : 'Dublin ' ,
121- "continent_code " : 'EU ' ,
122- "country_name " : 'Ireland ' ,
123- "latitude " : '90 ' ,
124- "longitude " : '10 ' ,
125- "postal_code " : 'IE ' ,
126- "region_name " : 'Europe ' ,
127- "timezone " : '+1000' ,
128- "country_code" : "IRL"
77+ ]
78+ },
79+ "session_count" : 123 ,
80+ "unsubscribed_from_emails " : True ,
81+ "last_request_at " : 1401970113 ,
82+ "created_at " : 1401970114 ,
83+ "remote_created_at " : 1393613864 ,
84+ "updated_at " : 1401970114 ,
85+ "user_agent_data " : "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_3) AppleWebKit/535.11 (KHTML, like Gecko) Chrome/17.0.963.56 Safari/535.11" ,
86+ "social_profiles" : {
87+ "type " : "social_profile.list" ,
88+ "social_profiles " : [
89+ {
90+ "type" : "social_profile" ,
91+ "name " : "twitter " ,
92+ "url " : "http:// twitter.com/abc " ,
93+ "username " : "abc" ,
94+ "id " : None
95+ },
96+ {
97+ "type" : "social_profile" ,
98+ "name " : "twitter " ,
99+ "username " : "abc2 " ,
100+ "url " : "http://twitter.com/ abc2" ,
101+ "id " : None
102+ },
103+ {
104+ "type" : "social_profile" ,
105+ "name " : "facebook " ,
106+ "url " : "http:// facebook.com/abc " ,
107+ "username " : "abc" ,
108+ "id " : "1234242"
109+ },
110+ {
111+ "type" : "social_profile" ,
112+ "name " : "quora " ,
113+ "url " : "http://facebook.com/abc " ,
114+ "username " : "abc" ,
115+ "id " : "1234242"
116+ }
117+ ]
118+ },
119+ "location_data" : {
120+ "type " : "location_data" ,
121+ "city_name " : 'Dublin' ,
122+ "continent_code " : 'EU ' ,
123+ "country_name " : 'Ireland ' ,
124+ "latitude " : '90 ' ,
125+ "longitude " : '10 ' ,
126+ "postal_code " : 'IE ' ,
127+ "region_name " : 'Europe ' ,
128+ "timezone " : '+1000 ' ,
129+ "country_code " : "IRL"
130+ }
129131 }
130- }
132+
133+
134+ def page_of_users (include_next_link = False ):
135+ page = {
136+ "type" : "user.list" ,
137+ "pages" : {
138+ "type" : "pages" ,
139+ "page" : 1 ,
140+ "next" : None ,
141+ "per_page" : 50 ,
142+ "total_pages" : 7
143+ },
144+ "users" : [test_user ("user1@example.com" ), test_user ("user2@example.com" ), test_user ("user3@example.com" )],
145+ "total_count" : 314
146+ }
147+ if include_next_link :
148+ page ["pages" ]["next" ] = "https://api.intercom.io/users?per_page=50&page=2"
149+ return page
150+
131151
132152# def test_messages
133153# [test_message, test_message]
0 commit comments