Skip to content

Commit 76c1ed1

Browse files
author
James Dalessio
committed
Move to device test.
1 parent bcd351b commit 76c1ed1

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

tests/test_network.py

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ def test_queue (self):
1818
channel = self.exp.get_channel(self.generate_name())
1919
listener = channel.listen('m', max_age=1)
2020
channel.broadcast('m', 1)
21+
time.sleep(.1)
2122
channel.broadcast('m', 2)
2223
time.sleep(2)
2324
channel.broadcast('m', 3)
2425
channel.broadcast('m', 4)
25-
time.sleep(.5)
2626
if not listener.wait(2).payload in [3, 4]:
2727
raise Exception
2828
if not listener.wait(2).payload in [3, 4]:
@@ -31,6 +31,18 @@ def test_queue (self):
3131
raise Exception
3232

3333

34+
def test_cloning (self):
35+
channel = self.exp.get_channel(self.generate_name())
36+
listener1 = channel.listen('hi')
37+
listener2 = channel.listen('hi');
38+
channel.broadcast('hi', {});
39+
40+
broadcast = listener1.wait(5)
41+
broadcast.payload['a'] = 1
42+
broadcast2 = listener2.wait(5)
43+
if 'a' in broadcast.payload and broadcast.payload['a'] == 1:
44+
raise Exception
45+
3446

3547

3648
class Test2 (utils.Base):
@@ -80,16 +92,3 @@ def test_listener_timeout (self):
8092
return
8193
raise Exception
8294

83-
def test_cloning (self):
84-
self.consumer_credentials['enable_network'] = True
85-
exp = self.exp_sdk.start(**self.consumer_credentials)
86-
channel = exp.get_channel('hi', consumer=True);
87-
listener1 = channel.listen('hi')
88-
listener2 = channel.listen('hi');
89-
channel.broadcast('hi', {});
90-
91-
broadcast = listener1.wait(5)
92-
broadcast.payload['a'] = 1
93-
broadcast2 = listener2.wait(5)
94-
if 'a' in broadcast.payload and broadcast.payload['a'] == 1:
95-
raise Exception

0 commit comments

Comments
 (0)