Пример #1
0
    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.'
Пример #2
0
 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())
Пример #3
0
    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'
Пример #4
0
    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'
Пример #5
0
    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."
Пример #6
0
 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())
Пример #7
0
    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)
Пример #8
0
    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)
Пример #9
0
    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)
Пример #10
0
    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)
Пример #11
0
 def test_is_not_valid_country(self):
     """Invalid country."""
     form = VIESModelForm({'vat_0': 'xx', 'vat_1': VALID_VIES_NUMBER})
     self.assertFalse(form.is_valid())
Пример #12
0
 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())
Пример #13
0
 def test_is_not_valid_country(self):
     """Invalid country."""
     form = VIESModelForm({
         'vat_0': 'xx',
         'vat_1': VALID_VIES_NUMBER})
     self.assertFalse(form.is_valid())
Пример #14
0
 def test_is_not_valid_country(self):
     """Invalid country."""
     form = VIESModelForm({"vat_0": "xx", "vat_1": VALID_VIES_NUMBER})
     self.assertFalse(form.is_valid())