forked from imapex-training/cicd_demoapp
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtesting.py
35 lines (25 loc) · 980 Bytes
/
testing.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
import demoapp
import unittest
class FlaskTestCase(unittest.TestCase):
def setUp(self):
demoapp.app.config['TESTING'] = True
self.app = demoapp.app.test_client()
def test_correct_http_response(self):
resp = self.app.get('/hello/world')
self.assertEquals(resp.status_code, 200)
def test_correct_content(self):
resp = self.app.get('/hello/world')
self.assertEquals(resp.data, '"Hello World!"\n')
def test_universe_correct_http_response(self):
resp = self.app.get('/hello/universe')
self.assertEquals(resp.status_code, 200)
def test_universe_correct_content(self):
resp = self.app.get('/hello/universe')
self.assertEquals(resp.data, '"Hello Universe!"\n')
def test_getCat_correct_http_response(self):
resp = self.app.get('/hello/cat')
self.assertEquals(resp.status_code, 200)
def tearDown(self):
pass
if __name__ == '__main__':
unittest.main()