-
Notifications
You must be signed in to change notification settings - Fork 0
/
test.py
42 lines (32 loc) · 1.3 KB
/
test.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
42
import unittest
from scaledrone import Scaledrone
drone = Scaledrone('KtJ2qzn3CF3svSFe', 'secret')
class Test(unittest.TestCase):
def test_publish(self):
r = drone.publish('notifications', {'foo': 'bar'})
self.assertEqual(r.status_code, 200)
def test_bulk_publish(self):
r = drone.publish(['notifications', 'room1', 'room2'], {'foo': 'bar'})
self.assertEqual(r.status_code, 200)
def test_channel_stats(self):
r = drone.channel_stats()
self.assertEqual(r.status_code, 200)
self.assertTrue('users_count' in r.json())
def test_members_list(self):
r = drone.members_list()
self.assertEqual(r.status_code, 200)
self.assertTrue(isinstance(r.json(), list))
def test_rooms_list(self):
r = drone.members_list()
self.assertEqual(r.status_code, 200)
self.assertTrue(isinstance(r.json(), list))
def test_room_members_list(self):
r = drone.room_members_list('notifications')
self.assertEqual(r.status_code, 200)
self.assertTrue(isinstance(r.json(), list))
def test_all_room_members_list(self):
r = drone.all_room_members_list()
self.assertEqual(r.status_code, 200)
self.assertTrue(isinstance(r.json(), dict))
if __name__ == '__main__':
unittest.main()