def test_is_valid_and_has_vatin_data(self): """Valid VATINFields' vatin_data() return result dict.""" form = VIESModelForm({'vat_0': 'CZ', 'vat_1': '24147931'}) assert form.is_valid() data = form.cleaned_data['vat'].data assert data['name'] == 'Braiins Systems s.r.o.'
def test_is_not_valid_numbers(self): """Invalid number.""" form = VIESModelForm({ 'vat_0': VALID_VIES_COUNTRY_CODE, 'vat_1': 'xx123+-' }) self.assertFalse(form.is_valid())
def test_is_valid_and_has_vatin_data(self): """Valid VATINFields' vatin_data() return result dict.""" form = VIESModelForm({'vat_0': 'NL', 'vat_1': '124851903B01'}) assert form.is_valid() data = form.cleaned_data['vat'].data assert data['name'] == 'JIETER'
def test_is_valid_and_has_vatin_data(self): """Valid VATINFields' vatin_data() return result dict.""" form = VIESModelForm({"vat_0": "CZ", "vat_1": "24147931"}) assert form.is_valid() data = form.cleaned_data["vat"].data assert data["name"] == "Braiins Systems s.r.o."
def test_is_not_valid_numbers(self): """Invalid number.""" form = VIESModelForm({ "vat_0": VALID_VIES_COUNTRY_CODE, "vat_1": "xx123+-" }) self.assertFalse(form.is_valid())
def test_is_valid(self): """Form is valid.""" form = VIESModelForm({ 'vat_0': VALID_VIES_COUNTRY_CODE, 'vat_1': VALID_VIES_NUMBER}) self.assertTrue(form.is_valid()) vies = form.save() self.assertEqual(vies.vat, VALID_VIES)
def test_is_valid(self): """Form is valid.""" form = VIESModelForm({ 'vat_0': VALID_VIES_COUNTRY_CODE, 'vat_1': VALID_VIES_NUMBER }) self.assertTrue(form.is_valid()) vies = form.save() self.assertEqual(vies.vat, VALID_VIES)
def test_save(self): """Form is saved.""" form = VIESModelForm({ 'vat_0': VALID_VIES_COUNTRY_CODE, 'vat_1': VALID_VIES_NUMBER}) self.assertTrue(form.is_valid()) vies_saved = form.save() vies_received = VIESModel.objects.get(pk=vies_saved.pk) self.assertEqual(vies_received, vies_saved) self.assertNotEqual(VIESModel.objects.count(), 0) self.assertEqual(vies_received.vat, VALID_VIES)
def test_save(self): """Form is saved.""" form = VIESModelForm({ 'vat_0': VALID_VIES_COUNTRY_CODE, 'vat_1': VALID_VIES_NUMBER }) self.assertTrue(form.is_valid()) vies_saved = form.save() vies_received = VIESModel.objects.get(pk=vies_saved.pk) self.assertEqual(vies_received, vies_saved) self.assertNotEqual(VIESModel.objects.count(), 0) self.assertEqual(vies_received.vat, VALID_VIES)
def test_is_not_valid_country(self): """Invalid country.""" form = VIESModelForm({'vat_0': 'xx', 'vat_1': VALID_VIES_NUMBER}) self.assertFalse(form.is_valid())
def test_is_not_valid_numbers(self): """Invalid number.""" form = VIESModelForm({ 'vat_0': VALID_VIES_COUNTRY_CODE, 'vat_1': 'xx123+-'}) self.assertFalse(form.is_valid())
def test_is_not_valid_country(self): """Invalid country.""" form = VIESModelForm({ 'vat_0': 'xx', 'vat_1': VALID_VIES_NUMBER}) self.assertFalse(form.is_valid())
def test_is_not_valid_country(self): """Invalid country.""" form = VIESModelForm({"vat_0": "xx", "vat_1": VALID_VIES_NUMBER}) self.assertFalse(form.is_valid())