-
Notifications
You must be signed in to change notification settings - Fork 3
/
testGenericAdaptorAPIs.py
74 lines (57 loc) · 2.59 KB
/
testGenericAdaptorAPIs.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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright (c) General Electric Company, 2017. All rights reserved.
# Prototype code for testing rt106GenericAdaptorREST.py
import unittest
import sys
print(sys.argv)
idx = sys.argv.index('testGenericAdaptorAPIs.py')
sys.argv = sys.argv[idx:]
from rt106GenericAdaptorREST import app
class TestGenericAPIs(unittest.TestCase):
def setUp(self): # NOSONAR
self.app = app.test_client()
def test_not_found(self):
url = 'http://localhost:7106/invalidinput'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 404)
def test_bad_request(self):
url = 'http://localhost:7106/?'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 400)
def test_status(self):
url = 'http://localhost:7106/'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 200)
def test_v1status(self):
url = 'http://localhost:7106/v1'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 200)
def test_api(self):
url = 'http://localhost:7106/v1/api'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 200)
def test_parameters(self):
url = 'http://localhost:7106/v1/parameters'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 200)
def test_results(self):
url = 'http://localhost:7106/v1/results'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 200)
def test_display(self):
url = 'http://localhost:7106/v1/results/display'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 200)
def test_queue(self):
url = 'http://localhost:7106/v1/queue'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 200)
def test_documentation(self):
url = 'http://localhost:7106/v1/documentation'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 200)
def test_classification(self):
url = 'http://localhost:7106/v1/classification'
response = self.app.get(url,content_type='application/json')
self.assertEqual(response.status_code, 200)
if __name__ == '__main__':
unittest.main()