def test_post(self): tester = create_app().test_client() response = tester.post('/fibonacci', json={'fibonacciStep': 0}) self.assertEqual(response.status_code, 200)
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')
def test_other(self): tester = create_app().test_client() response = tester.get('/a', content_type='html/text') self.assertEqual(response.status_code, 404)
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)
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)
def test_post_enpoint_fail(self): tester = create_app().test_client() response = tester.post('/fibonacci', json={'fibonacciStep': 'test'}) self.assertEqual(response.status_code, 400)
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)
def test_post_endpoint_fail(self): tester = create_app().test_client() response = tester.post('/factorial', json={'factorialTarget': 'fueh'}) self.assertEqual(response.status_code, 400)