Skip to content

Commit d8f1f79

Browse files
committed
Fixing the build on Travis.
Renaming test_user function so it's not treated as a test. Matching the querystring for collection proxy next page test.
1 parent 3a99050 commit d8f1f79

File tree

3 files changed

+12
-10
lines changed

3 files changed

+12
-10
lines changed

tests/unit/__init__.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ def _call(*args, **kwargs):
3434
return _call
3535

3636

37-
def a_test_user(email="bob@example.com"):
37+
def get_user(email="bob@example.com"):
3838
return {
3939
"type": "user",
4040
"id": "aaaaaaaaaaaaaaaaaaaaaaaa",
@@ -137,9 +137,9 @@ def page_of_users(include_next_link=False):
137137
"total_pages": 7
138138
},
139139
"users": [
140-
a_test_user("user1@example.com"),
141-
a_test_user("user2@example.com"),
142-
a_test_user("user3@example.com")],
140+
get_user("user1@example.com"),
141+
get_user("user2@example.com"),
142+
get_user("user3@example.com")],
143143
"total_count": 314
144144
}
145145
if include_next_link:

tests/unit/test_collection_proxy.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ def it_stops_iterating_if_no_next_link(self):
2929
def it_keeps_iterating_if_next_link(self):
3030
page1 = json.dumps(page_of_users(include_next_link=True))
3131
page2 = json.dumps(page_of_users(include_next_link=False))
32-
httpretty.register_uri(get, r(r"/users$"), body=page1)
3332
httpretty.register_uri(
34-
get, r(r'/users\?per_page=50&page=2$'),
33+
get, r(r"https://api.intercom.io/users$"), body=page1,
34+
match_querystring=True)
35+
httpretty.register_uri(
36+
get, r(r"https://api.intercom.io/users\?per_page=50&page=2"),
3537
body=page2, match_querystring=True)
3638
emails = [user.email for user in User.all()]
3739
eq_(emails, ['user1@example.com', 'user2@example.com', 'user3@example.com'] * 2) # noqa

tests/unit/test_user.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from nose.tools import eq_
1919
from nose.tools import ok_
2020
from nose.tools import istest
21-
from tests.unit import a_test_user
21+
from tests.unit import get_user
2222

2323

2424
get = httpretty.GET
@@ -61,7 +61,7 @@ def it_throws_an_attribute_error_on_trying_to_access_an_attribute_that_has_not_b
6161

6262
@istest
6363
def it_presents_a_complete_user_record_correctly(self):
64-
user = User.from_api(a_test_user())
64+
user = User.from_api(get_user())
6565
eq_('id-from-customers-app', user.user_id)
6666
eq_('bob@example.com', user.email)
6767
eq_('Joe Schmoe', user.name)
@@ -165,14 +165,14 @@ def it_rejects_nested_data_structures_in_custom_attributes(self):
165165
with assert_raises(ValueError):
166166
user.custom_attributes = {1: {2: 3}}
167167

168-
user = User.from_api(a_test_user())
168+
user = User.from_api(get_user())
169169
with assert_raises(ValueError):
170170
user.custom_attributes["thing"] = [1]
171171

172172
@istest
173173
@httpretty.activate
174174
def it_fetches_a_user(self):
175-
body = json.dumps(a_test_user())
175+
body = json.dumps(get_user())
176176

177177
httpretty.register_uri(
178178
get, r(r"https://api.intercom.io/users\?email="),

0 commit comments

Comments
 (0)