-
Notifications
You must be signed in to change notification settings - Fork 115
/
Copy pathtest_history_delete.py
41 lines (32 loc) · 1.07 KB
/
test_history_delete.py
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
38
39
40
41
import unittest
import threading
from pubnub.pubnub import PubNub
from tests.helper import pnconf_env_copy
class TestPubNubSuccessHistoryDelete(unittest.TestCase): # pylint: disable=W0612
def setUp(self):
self.event = threading.Event()
def callback(self, response, status):
self.response = response
self.status = status
self.event.set()
def assert_success(self):
self.event.wait()
if self.status.is_error():
self.fail(str(self.status.error_data.exception))
self.event.clear()
self.response = None
self.status = None
def test_success(self):
PubNub(pnconf_env_copy()).delete_messages() \
.channel("my-ch") \
.start(123) \
.end(456) \
.pn_async(self.callback)
self.assert_success()
def test_super_call(self):
PubNub(pnconf_env_copy()).delete_messages() \
.channel("my-ch- |.* $") \
.start(123) \
.end(456) \
.pn_async(self.callback)
self.assert_success()