2
0

[FIX] Set country id with ref, one line exercise test_validate_wrong_vat_shows_simple_message

This commit is contained in:
Eduardo De Miguel 2022-06-10 10:55:32 +02:00 committed by Rodrigo
parent adc3f5b380
commit b5e81d3a6e

View File

@ -24,7 +24,7 @@ class TestResPartner(common.TransactionCase):
with mock.patch(self.vatnumber_path) as mock_vatnumber: with mock.patch(self.vatnumber_path) as mock_vatnumber:
mock_vatnumber.check_vies.return_value = True mock_vatnumber.check_vies.return_value = True
self.partner.vat = "ESB87530432" self.partner.vat = "ESB87530432"
self.partner.country_id = 20 self.partner.country_id = self.env.ref("base.be")
self.assertEqual(self.partner.vies_passed, True) self.assertEqual(self.partner.vies_passed, True)
def test_exception_vat_vies(self): def test_exception_vat_vies(self):
@ -44,14 +44,14 @@ class TestResPartner(common.TransactionCase):
self.company.vat_check_vies = False self.company.vat_check_vies = False
mock_vatnumber.check_vies.return_value = False mock_vatnumber.check_vies.return_value = False
self.partner.vat = "MXGODE561231GR8" self.partner.vat = "MXGODE561231GR8"
self.partner.country_id = 156 self.partner.country_id = self.env.ref("base.mx")
self.assertEqual(self.partner.vies_passed, False) self.assertEqual(self.partner.vies_passed, False)
def test_validate_vies_passed_false_when_vat_set_to_false(self): def test_validate_vies_passed_false_when_vat_set_to_false(self):
with mock.patch(self.vatnumber_path) as mock_vatnumber: with mock.patch(self.vatnumber_path) as mock_vatnumber:
mock_vatnumber.check_vies.return_value = True mock_vatnumber.check_vies.return_value = True
self.partner.vat = "ESB87530432" self.partner.vat = "ESB87530432"
self.partner.country_id = 20 self.partner.country_id = self.env.ref("base.be")
self.assertEqual(self.partner.vies_passed, True) self.assertEqual(self.partner.vies_passed, True)
self.partner.vat = False self.partner.vat = False
self.assertEqual(self.partner.vies_passed, False) self.assertEqual(self.partner.vies_passed, False)
@ -59,4 +59,3 @@ class TestResPartner(common.TransactionCase):
def test_validate_wrong_vat_shows_simple_message(self): def test_validate_wrong_vat_shows_simple_message(self):
with self.assertRaisesRegex(ValidationError, "does not seem to be valid"): with self.assertRaisesRegex(ValidationError, "does not seem to be valid"):
self.partner.vat = "ES11111111A" self.partner.vat = "ES11111111A"
self.partner.country_id = 20