-
Notifications
You must be signed in to change notification settings - Fork 0
/
test_notifier_sms.py
58 lines (48 loc) · 2.3 KB
/
test_notifier_sms.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
import os
import ubivar
import warnings
from ubivar.test.helper import (UbivarTestCase, NOW)
DUMMY_SMS = {
"description": "DUMMY SMS",
"value": "+1 123 123 123",
"is_active": "true"
}
class UbivarAPIResourcesTests(UbivarTestCase):
def test_notifier_sms_create(self):
response = ubivar.NotifierSms.create(**DUMMY_SMS)
notifierSms = response.data[len(response.data)-1]
self.assertTrue(hasattr(response, "data"))
self.assertEqual(notifierSms["description"], DUMMY_SMS["description"])
self.assertEqual(notifierSms["value"] , DUMMY_SMS["value"])
self.assertEqual(notifierSms["is_active"] , DUMMY_SMS["is_active"])
self.assertEqual(response.object, "notifier_sms")
def test_notifier_sms_retrieve(self):
response = ubivar.NotifierSms.retrieve("0")
self.assertTrue(hasattr(response.data, "__iter__"))
self.assertTrue(response.object == "notifier_sms")
self.assertTrue(len(response.data))
def test_notifier_sms_list(self):
response = ubivar.NotifierSms.list()
self.assertTrue(hasattr(response.data, "__iter__"))
self.assertTrue(response.object == "notifier_sms")
def test_notifier_sms_update(self):
response = ubivar.NotifierSms.list()
for i in range(0, len(response.data)):
response = ubivar.NotifierSms.delete(str(i))
response = ubivar.NotifierSms.create(**DUMMY_SMS)
response = ubivar.NotifierSms.create(**DUMMY_SMS)
newDescription = "new description"
newValue = "new value"
newStatus= "false"
response = ubivar.NotifierSms.update("1", description=newDescription,
value=newValue, is_active=newStatus)
notifierSms = response.data[len(response.data) - 1]
self.assertEqual(notifierSms["description"], newDescription)
self.assertEqual(notifierSms["value"], newValue)
self.assertEqual(notifierSms["is_active"], newStatus)
self.assertEqual(response.object, "notifier_sms")
def test_notifier_sms_delete(self):
response = ubivar.NotifierSms.list()
for i in range(0, len(response.data)):
response = ubivar.NotifierSms.delete(str(i))
self.assertEqual(response.object, "notifier_sms")