def test_invalid_iban(): payment = Payment(debtor=biz_with_cuc, account='ITINVALIDIBAN') with pytest.raises(InvalidIBANError): payment.xml() payment.account = 'XXINVALIDIBAN' payment.abi = '01234' with pytest.raises(InvalidIBANError): payment.xml() payment.account = acct_37.replace('IT37', 'IT99') with pytest.raises(InvalidIBANError): payment.xml()
def test_missing_attrs_payment(): "Payments must always have a `debtor` and an `account` attribute." payment = Payment() with pytest.raises(AttributeError): payment.xml() payment.debtor = biz_with_cuc with pytest.raises(AttributeError): payment.xml() payment.account = acct_37 # No exception must be raised payment.add_transaction(amount=1, account=acct_86, rmtinfo='Test', creditor=biz) payment.xml()