Esempio n. 1
0
    def test_iban_starts_with_country_code(self):
        with pytest.raises(ValidationError):
            account_args = {
                'holder': self.bank_user,
                'iban': '991212345678012345678',
            }

            new_account = models.BankAccount(**account_args)
            new_account.save()
Esempio n. 2
0
    def test_bban_cannot_exceed_thirty_characters(self):
        with pytest.raises(ValidationError):
            account_args = {
                'holder': self.bank_user,
                'iban': 'DE55{0}{0}{0}1'.format('0123456789'),
            }

            new_account = models.BankAccount(**account_args)
            new_account.save()
Esempio n. 3
0
    def test_iban_has_check_digits_after_country_code(self):
        with pytest.raises(ValidationError):
            account_args = {
                'holder': self.bank_user,
                'iban': '99WW12345678012345678',
            }

            new_account = models.BankAccount(**account_args)
            new_account.save()
Esempio n. 4
0
    def test_well_formated_iban_is_accepted(self):
        accounts_len = len(models.BankAccount.objects.all())
        account_args = {
            'holder': self.bank_user,
            'iban': 'DE1212345678012345678',
        }

        new_account = models.BankAccount(**account_args)
        new_account.save()
        assert len(models.BankAccount.objects.all()) == accounts_len + 1
Esempio n. 5
0
    def test_iban_does_not_allow_special_characters(self):
        with pytest.raises(ValidationError):
            account_args = {
                'holder': self.bank_user,
            }

            for invalid_char in self.invalid_chars:
                account_args['iban'] = 'DE1212345678012345678{}'.format(
                    invalid_char)
                new_account = models.BankAccount(**account_args)
                new_account.save()