blob: 3cf8e03b4b4c004238062352d73dfaaa59b82984 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
|
from pubnub import Pubnub
import time
import random
from nose.tools import with_setup
pubnub = Pubnub("ds","ds")
pubnub_enc = Pubnub(publish_key="ds",subscribe_key="ds",cipher_key="enigma")
def rand(msg):
return "rand-" + str(random.random()) + "-" + msg
channel = rand("channel")
channel_enc = rand("channel_enc")
messages = []
def setup_func():
for i in range(0,20):
msg = rand("message-" + str(i))
messages.append(msg)
pubnub.publish(channel=channel, message=msg)
pubnub_enc.publish(channel=channel_enc, message=msg)
@with_setup(setup_func)
def test_1():
time.sleep(3)
hresp = pubnub.history(channel=channel, count=20)
hresp2 = pubnub_enc.history(channel=channel_enc, count=20)
assert hresp[0] == messages
assert hresp2[0] == messages
|