aboutsummaryrefslogtreecommitdiffstats
path: root/python/tests/test_history.py
diff options
context:
space:
mode:
authorDevendra2015-06-19 02:58:40 +0530
committerDevendra2015-06-19 02:58:40 +0530
commitd6455babd00c0747559c6d1a21fc195e1f18dbc7 (patch)
treedbf7f1d8e88ad8cbda81756283c3f2a748219647 /python/tests/test_history.py
parent2eeb6f481e646cae91317786160086ea91447c85 (diff)
downloadpubnub-python-d6455babd00c0747559c6d1a21fc195e1f18dbc7.tar.bz2
added history test
Diffstat (limited to 'python/tests/test_history.py')
-rw-r--r--python/tests/test_history.py37
1 files changed, 37 insertions, 0 deletions
diff --git a/python/tests/test_history.py b/python/tests/test_history.py
new file mode 100644
index 0000000..3cf8e03
--- /dev/null
+++ b/python/tests/test_history.py
@@ -0,0 +1,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
+
+
+