def test_invalid_payload(self): request = mock.MagicMock() payload = {'data': {'m': 1}} request.json = payload request.method = 'POST' response = math(request) assert response[1] == 400
def test_fact_bad_param(self): request = mock.MagicMock() payload = {'function': 'factorial', 'data': {'m': 1}} request.json = payload request.method = 'POST' response = math(request) assert response[1] == 400
def test_ack_naive_bad_param(self): request = mock.MagicMock() payload = {'function': 'ackermann_naive', 'data': {'n': 1}} request.json = payload request.method = 'POST' response = math(request) assert response[1] == 400
def test_fib_happy_path(self): request = mock.MagicMock() payload = {'function': 'fibonacci', 'data': {'n': 4}} request.json = payload request.method = 'POST' response = math(request) assert response[1] == 200
def test_ack_happy_path(self): request = mock.MagicMock() payload = {'function': 'ackermann', 'data': {'m': 2, 'n': 1}} request.json = payload request.method = 'POST' response = math(request) assert response[1] == 200
def simulate_endpoint(): return math(request)