Skip to content

Commit d696276

Browse files
author
minaorangina
committed
allows dash (-) in interest name. makes tests more deterministic
1 parent 7700664 commit d696276

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
lines changed

pusher_push_notifications/__init__.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
SDK_VERSION = '0.9.2'
1010
INTEREST_MAX_LENGTH = 164
11-
INTEREST_REGEX = re.compile('^(_-|=|@|,|\\.|:|[A-Z]|[a-z]|[0-9])*$')
11+
INTEREST_REGEX = re.compile('^(_|-|=|@|,|\\.|:|[A-Z]|[a-z]|[0-9])*$')
1212
MAX_NUMBER_OF_INTERESTS = 100
1313

1414

@@ -135,7 +135,7 @@ def publish(self, interests, publish_body):
135135
interest,
136136
)
137137
+ 'Allowed characters are: ASCII upper/lower-case letters, '
138-
+ 'numbers or one of _=@,.:'
138+
+ 'numbers or one of _=@,.:-'
139139
)
140140

141141
publish_body['interests'] = interests

tests/test_push_notifications.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ def test_publish_should_succeed_if_100_interests_passed(self):
192192
},
193193
)
194194
pn_client.publish(
195-
interests=[str(el) for el in random.sample(range(1000), 100)],
195+
interests=['interest-' + str(i) for i in range(0, 100)],
196196
publish_body={
197197
'apns': {
198198
'aps': {
@@ -207,8 +207,6 @@ def test_publish_should_fail_if_too_many_interests_passed(self):
207207
'INSTANCE_ID',
208208
'SECRET_KEY'
209209
)
210-
interests_ints = random.sample(range(1000), 101)
211-
212210
with requests_mock.Mocker() as http_mock:
213211
http_mock.register_uri(
214212
requests_mock.ANY,
@@ -220,7 +218,7 @@ def test_publish_should_fail_if_too_many_interests_passed(self):
220218
)
221219
with self.assertRaises(ValueError):
222220
pn_client.publish(
223-
interests=[str(el) for el in interests_ints],
221+
interests=['interest-' + str(i) for i in range(0, 101)],
224222
publish_body={
225223
'apns': {
226224
'aps': {

0 commit comments

Comments
 (0)