diff --git a/README.md b/README.md index 9008463..e02514f 100644 --- a/README.md +++ b/README.md @@ -30,7 +30,7 @@ python3 -m flask --app api run --port 8000 ``` cd api -python3 -m unittest discover tests +python3 -m unittest discover -p 'test_*.py' ``` ### Run Flake8 and isort diff --git a/api/api/routes.py b/api/api/routes.py index a2c3e1f..4fae7dc 100644 --- a/api/api/routes.py +++ b/api/api/routes.py @@ -49,7 +49,7 @@ def _ask(request_data, validate_captcha=True, access_key=None): access_key=access_key) ok = validator.validate() if not ok: - return jsonify(message=validator.errors), validator.http_return_code + return jsonify(errors=validator.errors), validator.http_return_code # convert amount to wei format amount_wei = Web3.to_wei(validator.amount, 'ether') diff --git a/api/tests/test_api_cli.py b/api/tests/test_api_cli.py index 608dccb..4c39641 100644 --- a/api/tests/test_api_cli.py +++ b/api/tests/test_api_cli.py @@ -59,6 +59,7 @@ def test_ask_route_parameters(self): 'tokenAddress': ERC20_TOKEN_ADDRESS }) self.assertEqual(response.status_code, 429) + self.assertIn('errors', response.get_json().keys()) if __name__ == '__main__':