Skip to content

Commit 22dbadd

Browse files
committed
Tests: Make test postfixes better unique
1 parent e1e4f38 commit 22dbadd

1 file changed

Lines changed: 6 additions & 5 deletions

File tree

‎stream/tests.py‎

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
from stream import serializer
1717
from requests.exceptions import MissingSchema
1818
from itertools import count
19+
from uuid import uuid4
1920

2021
try:
2122
from urlparse import urlparse, parse_qs
@@ -46,18 +47,18 @@ def connect_debug():
4647
client = connect_debug()
4748

4849
counter = count()
49-
test_timestamp = int(time.time())
50+
test_identifier = uuid4()
5051

5152

52-
def get_random_postfix():
53-
return '---test_%s-feed_%s' % (test_timestamp, next(counter))
53+
def get_unique_postfix():
54+
return '---test_%s-feed_%s' % (test_identifier, next(counter))
5455

5556

5657
def getfeed(feed_slug, user_id):
5758
'''
5859
Adds the random postfix to the user id
5960
'''
60-
return client.feed(feed_slug, user_id + get_random_postfix())
61+
return client.feed(feed_slug, user_id + get_unique_postfix())
6162

6263

6364
class ClientTest(TestCase):
@@ -709,7 +710,7 @@ def test_uniqueness_topic(self):
709710
self.flat3.follow('user', self.user1.user_id)
710711
# add the same activity twice
711712
now = datetime.datetime.now(tzlocal())
712-
tweet = 'My Way %s' % get_random_postfix()
713+
tweet = 'My Way %s' % get_unique_postfix()
713714
activity_data = {
714715
'actor': 1, 'verb': 'tweet', 'object': 1, 'time': now, 'tweet': tweet}
715716
self.topic1.add_activity(activity_data)

0 commit comments

Comments
 (0)