-
Notifications
You must be signed in to change notification settings - Fork 1
/
unittest.py
53 lines (41 loc) · 1.89 KB
/
unittest.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
import unittest
from app import app
class TestApp(unittest.TestCase):
def test_home_route(self):
client = app.test_client()
response = client.get('/')
self.assertEqual(response.status_code, 200)
self.assertIn('Version', response.data.decode())
self.assertIn('ModuleVersion', response.data.decode())
def test_check_route(self):
client = app.test_client()
response = client.get('/check')
self.assertEqual(response.status_code, 200)
self.assertEqual(response.data.decode(), 'Ok')
def test_accessTkn_esia_route(self):
client = app.test_client()
response = client.post('/accessTkn_esia', json={'api_key': 'my api key'})
self.assertEqual(response.status_code, 200)
self.assertTrue('accessTkn' in response.json())
def test_order_route(self):
client = app.test_client()
response = client.post('/order', json={'api_key': 'my api key'})
self.assertEqual(response.status_code, 200)
self.assertTrue('orderId' in response.json())
def test_push_route(self):
client = app.test_client()
response = client.post('/push', json={'api_key': 'my api key'})
self.assertEqual(response.status_code, 200)
self.assertTrue('pushId' in response.json())
def test_push_chunked_route(self):
client = app.test_client()
response = client.post('/push/chunked', json={'api_key': 'my api key'})
self.assertEqual(response.status_code, 200)
self.assertTrue('pushId' in response.json())
def test_status_route(self):
client = app.test_client()
response = client.post('/status', json={'api_key': 'my api key'})
self.assertEqual(response.status_code, 200)
self.assertTrue('orderId' in response.json())
if __name__ == '__main__':
unittest.main()