Skip to content

Commit

Permalink
Small fix for undefined
Browse files Browse the repository at this point in the history
  • Loading branch information
seeker25 committed Nov 5, 2024
1 parent 6ed2a5a commit 2cdcafe
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pay-api/src/pay_api/resources/v1/account.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ 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:
if account_number == "undefined":
return error_to_response(Error.INVALID_REQUEST, invalid_params='account_number')
request_json = request.get_json()
current_app.logger.debug(request_json)
Expand Down
12 changes: 6 additions & 6 deletions pay-api/tests/unit/api/test_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ def test_account_purchase_history_with_basic_account(session, client, jwt, app):
headers=headers,
)

pay_account: PaymentAccount = PaymentAccountService.find_account(get_auth_basic_user())
pay_account = PaymentAccountService.find_account(get_auth_basic_user())

rv = client.post(
f"/api/v1/accounts/{pay_account.auth_account_id}/payments/queries",
Expand All @@ -141,8 +141,8 @@ def test_account_purchase_history_pagination(session, client, jwt, app):
headers=headers,
)

invoice: Invoice = Invoice.find_by_id(rv.json.get("id"))
pay_account: PaymentAccount = PaymentAccount.find_by_id(invoice.payment_account_id)
invoice = Invoice.find_by_id(rv.json.get("id"))
pay_account = PaymentAccount.find_by_id(invoice.payment_account_id)

rv = client.post(
f"/api/v1/accounts/{pay_account.auth_account_id}/payments/queries?page=1&limit=5",
Expand Down Expand Up @@ -184,8 +184,8 @@ def test_account_purchase_history_with_service_account(session, client, jwt, app
headers=headers,
)

invoice: Invoice = Invoice.find_by_id(rv.json.get("id"))
pay_account: PaymentAccount = PaymentAccount.find_by_id(invoice.payment_account_id)
invoice = Invoice.find_by_id(rv.json.get("id"))
pay_account = PaymentAccount.find_by_id(invoice.payment_account_id)

token = jwt.create_jwt(get_claims(roles=[Role.SYSTEM.value], product_code="CSO"), token_header)
headers = {"Authorization": f"Bearer {token}", "content-type": "application/json"}
Expand Down Expand Up @@ -389,7 +389,7 @@ def test_bad_id_payment_queries(session, client, jwt, app):
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",
"/api/v1/accounts/undefined/payments/queries",
data=json.dumps({}),
headers=headers,
)
Expand Down

0 comments on commit 2cdcafe

Please sign in to comment.