예제 #1
0
 def test_post(self):
     tester = create_app().test_client()
     response = tester.post('/fibonacci', json={'fibonacciStep': 0})
     self.assertEqual(response.status_code, 200)
예제 #2
0
 def test_home(self):
     tester = create_app().test_client()
     response = tester.get('/', content_type='html/text')
     self.assertEqual(response.status_code, 200)
     self.assertEqual(response.data,
                      b'Please refer to the endpoint documentation')
예제 #3
0
 def test_other(self):
     tester = create_app().test_client()
     response = tester.get('/a', content_type='html/text')
     self.assertEqual(response.status_code, 404)
예제 #4
0
 def test_get_endpoint_succes(self):
     tester = create_app().test_client()
     response = tester.get('/ackermann/1/1', content_type='html/text')
     self.assertEqual(response.status_code, 200)
예제 #5
0
 def test_post_endpoint_fail(self):
     tester = create_app().test_client()
     response = tester.post('/ackermann', json={'m': 'fiej', 'n': 1})
     self.assertEqual(response.status_code, 400)
예제 #6
0
 def test_post_enpoint_fail(self):
     tester = create_app().test_client()
     response = tester.post('/fibonacci', json={'fibonacciStep': 'test'})
     self.assertEqual(response.status_code, 400)
예제 #7
0
 def test_get_endpoint_fail(self):
     tester = create_app().test_client()
     response = tester.get('/fibonacci/test', content_type='html/text')
     self.assertEqual(response.status_code, 404)
예제 #8
0
 def test_post_endpoint_fail(self):
     tester = create_app().test_client()
     response = tester.post('/factorial', json={'factorialTarget': 'fueh'})
     self.assertEqual(response.status_code, 400)