Example #1
0
 def test_post(self):
     tester = create_app().test_client()
     response = tester.post('/fibonacci', json={'fibonacciStep': 0})
     self.assertEqual(response.status_code, 200)
Example #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')
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)
Example #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)