Skip to content

Commit

Permalink
Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
rodrigo-barraza committed Jan 31, 2024
1 parent 268fb2d commit 34924d3
Showing 1 changed file with 19 additions and 20 deletions.
39 changes: 19 additions & 20 deletions pay-api/tests/unit/services/test_payment_account.py
Original file line number Diff line number Diff line change
Expand Up @@ -389,67 +389,66 @@ def test_find_eft_accounts(session, client, jwt, app, admin_users_mock):
"""Assert that the find EFT accounts is working as expected."""
page = 1
limit = 5
auth_account_id='12345678'
payment_account = PaymentAccountService.create(get_premium_account_payload(payment_method=PaymentMethod.EFT.value, account_id=auth_account_id))
auth_account_id = '12345678'
payment_account = PaymentAccountService.create(get_premium_account_payload(
payment_method=PaymentMethod.EFT.value, account_id=auth_account_id))
PaymentAccountService.enable_eft(payment_account.auth_account_id)
eft_shortname = factory_eft_shortname(short_name='TESTSHORTNAME', auth_account_id=auth_account_id).save()

payment_account = PaymentAccountService.find_by_id(payment_account.id)
assert payment_account.payment_method == PaymentMethod.EFT.value
assert payment_account.eft_enable is True
assert payment_account.auth_account_id == auth_account_id

assert eft_shortname.auth_account_id == auth_account_id

eft_accounts = PaymentAccountService.find_eft_accounts(page=page, limit=limit)
assert eft_accounts['limit'] == limit
assert eft_accounts['page'] == page
assert eft_accounts['total'] == 0

# Create 10 eft enabled accounts
for i in range(10):
payment_account = PaymentAccountService.create(get_premium_account_payload(account_id=f'{123}{i}',
payment_method=PaymentMethod.EFT.value))
payment_account = PaymentAccountService.create(get_premium_account_payload(
account_id=f'{123}{i}', payment_method=PaymentMethod.EFT.value))
PaymentAccountService.enable_eft(payment_account.auth_account_id)

payment_account = PaymentAccountService.find_by_id(payment_account.id)
assert payment_account.payment_method == PaymentMethod.EFT.value
assert payment_account.eft_enable is True

# Create 5 eft shortnames
for i in range(5):
eft_shortname = factory_eft_shortname(short_name=f'TESTSHORTNAME{i}', auth_account_id=f'{123}{i}').save()

eft_accounts = PaymentAccountService.find_eft_accounts(page=page, limit=limit)
assert eft_accounts['limit'] == limit
assert eft_accounts['page'] == page
assert eft_accounts['total'] == 5

# Create 5 eft enabled accounts
for i in range(5):
payment_account = PaymentAccountService.create(get_premium_account_payload(account_id=f'{1234}{i}',
payment_method=PaymentMethod.EFT.value))
payment_account = PaymentAccountService.create(get_premium_account_payload(
account_id=f'{1234}{i}', payment_method=PaymentMethod.EFT.value))
PaymentAccountService.enable_eft(payment_account.auth_account_id)

payment_account = PaymentAccountService.find_by_id(payment_account.id)
assert payment_account.payment_method == PaymentMethod.EFT.value
assert payment_account.eft_enable is True

# Create 5 eft disabled accounts
for i in range(5):
payment_account = PaymentAccountService.create(get_premium_account_payload(account_id=f'{12345}{i}',
payment_method=PaymentMethod.EFT.value))
payment_account = PaymentAccountService.create(get_premium_account_payload(
account_id=f'{12345}{i}', payment_method=PaymentMethod.EFT.value))
payment_account = PaymentAccountService.find_by_id(payment_account.id)
assert payment_account.payment_method == PaymentMethod.EFT.value
assert payment_account.eft_enable is False

# Create 5 eft shortnames
for i in range(5):
eft_shortname = factory_eft_shortname(short_name=f'TESTSHORTNAME{i}', auth_account_id=f'{123}{i}').save()

eft_accounts = PaymentAccountService.find_eft_accounts(page=page, limit=limit)
assert eft_accounts['limit'] == limit
assert eft_accounts['page'] == page
assert eft_accounts['total'] == 5


assert eft_accounts['total'] == 10

0 comments on commit 34924d3

Please sign in to comment.