-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathM800ApiTest.py
More file actions
44 lines (34 loc) · 1.25 KB
/
M800ApiTest.py
File metadata and controls
44 lines (34 loc) · 1.25 KB
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
#!/usr/bin/env python
import unittest
from M800Api import M800Api
class M800ApiTest(unittest.TestCase):
key = '<put your developer key here>';
secret = '<put your developer secret here>';
host = 'api.m800.com';
port = 443;
sender = '<sender phone number>';
to = '<recipient phone number>';
msg = 'Python API client test message.';
def test_send_sms(self):
request = {
'from': self.sender,
'type': 'text',
'messageClass': 'normal',
'body': self.msg
}
api = M800Api(self.key, self.secret, self.host, self.port);
response = api.send_sms(self.to, request)
print response
def test_send_text_sms(self):
api = M800Api(self.key, self.secret, self.host, self.port);
response = api.send_text_sms(self.sender, self.to, 'normal', self.msg)
print response
if __name__ == "__main__":
test_classes = [ M800ApiTest ]
for test_class in test_classes:
temp = str(test_class)
name = temp.split('.')[-1][:-2]
print "Start of test for", name
suite = unittest.TestLoader().loadTestsFromTestCase(test_class)
unittest.TextTestRunner(verbosity=2).run(suite)
print "End of test for", name