def test_account_invalid_lookup(session): """Invalid account test.""" p = PaymentAccountService.find_account('1234', 'CP', 'PAYBC') assert p is not None assert p.id is None import pytest from pay_api.exceptions import BusinessException from pay_api.utils.errors import Error with pytest.raises(BusinessException) as excinfo: PaymentAccountService.find_account(None, None, None) assert excinfo.value.status == Error.PAY004.status
def test_account_invalid_lookup(session): """Invalid account test.""" business_info: Dict = {'businessIdentifier': '1234', 'corpType': 'CP'} p = PaymentAccountService.find_account(business_info, get_auth_basic_user(), 'PAYBC') assert p is not None assert p.id is None import pytest from pay_api.exceptions import BusinessException from pay_api.utils.errors import Error with pytest.raises(BusinessException) as excinfo: PaymentAccountService.find_account({}, get_auth_basic_user(), 'PAYBC') assert excinfo.value.status == Error.PAY004.status
def test_account_invalid_premium_account_lookup(session): """Invalid account test.""" business_info: Dict = {} p = PaymentAccountService.find_account(business_info, get_auth_premium_user(), 'BCOL') assert p is not None assert p.id is None import pytest from pay_api.exceptions import BusinessException from pay_api.utils.errors import Error with pytest.raises(BusinessException) as excinfo: PaymentAccountService.find_account(business_info, {}, 'BCOL') assert excinfo.value.status == Error.PAY015.status
def test_premium_account_saved_from_new(session): """Assert that the payment is saved to the table.""" payment_account = factory_premium_payment_account() payment_account.save() pa = PaymentAccountService.find_account(get_auth_premium_user()) assert pa is not None assert pa.id is not None
def test_direct_pay_account_saved_from_new(session): """Assert that the payment is saved to the table.""" payment_account = factory_payment_account(payment_method_code=PaymentMethod.DIRECT_PAY.value) payment_account.save() pa = PaymentAccountService.find_account(get_auth_basic_user()) assert pa is not None assert pa.id is not None
def test_premium_account_saved_from_new(session): """Assert that the payment is saved to the table.""" payment_account = factory_premium_payment_account() payment_account.save() pa = PaymentAccountService.find_account({}, get_auth_premium_user(), payment_system='BCOL', payment_method=PaymentMethod.DRAWDOWN.value) assert pa is not None assert pa.id is not None
def test_account_saved_from_new(session): """Assert that the payment is saved to the table.""" payment_account = factory_payment_account() payment_account.save() pa = PaymentAccountService.find_account(payment_account.corp_number, payment_account.corp_type_code, payment_account.payment_system_code) assert pa is not None assert pa.id is not None assert pa.corp_number is not None assert pa.corp_type_code is not None assert pa.payment_system_code is not None assert pa.asdict() is not None
def test_direct_pay_account_saved_from_new(session): """Assert that the payment is saved to the table.""" payment_account = factory_payment_account(payment_method_code=PaymentMethod.DIRECT_PAY.value) payment_account.save() business_info: Dict = { 'businessIdentifier': payment_account.corp_number, 'corpType': payment_account.corp_type_code } pa = PaymentAccountService.find_account(business_info, get_auth_basic_user(), 'PAYBC') assert pa is not None assert pa.id is not None assert pa.corp_number is not None assert pa.corp_type_code is not None