-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtest_lifecellapi.py
40 lines (33 loc) · 1006 Bytes
/
test_lifecellapi.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
# -*- coding: utf-8 -*-
#!/usr/bin/env python
import unittest
from lifecellapi import (LifecellSession, LifecellApi,
LifecellApiWrongMethodError, LifecellApiError
)
class LifecellApiTest(unittest.TestCase):
def setUp(self):
self.s = LifecellSession('380931234567', '123456')
self.api = LifecellApi(self.s)
self.req = {
'accessKeyCode': self.s.settings['access_key_code'],
'msisdn': self.s.num,
'superPassword': self.s.pwd
}
def testApiWrongRequest(self):
try:
self.api.wrongApi()
except LifecellApiWrongMethodError as e:
pass
except e:
self.fail('Unexpected exception throw:', e)
else:
self.fail('LifecellApiWrongMethodError not throw')
def testApiErrorRequest(self):
try:
self.api.getToken()
except LifecellApiError as e:
pass
except e:
self.fail('Unexpected exception throw:', e)
else:
self.fail('LifecellApiError not throw')