Skip to content

Commit

Permalink
Small change to fix error
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 committed Nov 5, 2024
1 parent b2590b2 commit 28cab6d
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 0 deletions.
2 changes: 2 additions & 0 deletions pay-api/src/pay_api/resources/v1/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,6 +258,8 @@ def put_account_fee_product(account_number: str, product: str):
def post_search_purchase_history(account_number: str):
"""Search purchase history."""
current_app.logger.info("<post_search_purchase_history")
if account_number and account_number.isnumeric() is False:
return error_to_response(Error.INVALID_REQUEST, invalid_params='account_number')
request_json = request.get_json()
current_app.logger.debug(request_json)
# Validate the input request
Expand Down
13 changes: 13 additions & 0 deletions pay-api/tests/unit/api/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,19 @@ def test_account_purchase_history_default_list(session, client, jwt, app):
assert rv.json.get("total") == 10


def test_bad_id_payment_queries(session, client, jwt, app):
"""Assert testing a string inside of the route doesn't work."""
token = jwt.create_jwt(get_claims(), token_header)
headers = {"Authorization": f"Bearer {token}", "content-type": "application/json"}
rv = client.post(
"/api/v1/accounts/HELLO/payments/queries",
data=json.dumps({}),
headers=headers,
)
assert rv.status_code == 400
assert rv.json.get("invalidParams") == "account_number"


def test_basic_account_creation(session, client, jwt, app):
"""Assert that the endpoint returns 201."""
token = jwt.create_jwt(get_claims(role=Role.SYSTEM.value), token_header)
Expand Down

0 comments on commit 28cab6d

Please sign in to comment.