Exemplo n.º 1
0
 def test_ie_regex_verification(self):
     for vn in VALID_VIES_IE:
         v = VATIN('IE', vn)
         v.verify()
     v = VATIN('IE', '1234567890')
     with pytest.raises(ValidationError) as e:
         v.verify()
     assert "IE1234567890 does not match the country's VAT ID specifications." in e.value
Exemplo n.º 2
0
 def test_ie_regex_verification(self):
     for vn in VALID_VIES_IE:
         v = VATIN('IE', vn)
         v.verify()
     v = VATIN('IE', '1234567890')
     with pytest.raises(ValidationError) as e:
         v.verify()
     assert "IE1234567890 does not match the country's VAT ID specifications." in e.value
Exemplo n.º 3
0
    def run(self):
        contact = self.storage.read_contact(self.args.contact)
        vat_reg = contact.get("vat_reg", "")
        if vat_reg:
            vat_reg = vat_reg.strip().replace(" ", "")
            vatin = VATIN(vat_reg[:2], vat_reg[2:])
            if self.args.skip_validation:
                vatin.verify()
            elif not vatin.data.valid:
                raise Exception("Invalid VAT: {}".format(vat_reg))

        filename = self.storage.create(self.args.contact)
        print(filename)
        if self.args.edit:
            subprocess.run(["gvim", filename])