Browse Source

[IMP] Code coverage

12.0-mig-module_prototyper_last
KevinKhao 5 years ago
parent
commit
3044d1db2e
  1. 14
      base_exception/tests/test_base_exception.py

14
base_exception/tests/test_base_exception.py

@ -45,11 +45,11 @@ class TestBaseException(common.SavepointCase):
} }
) )
def test_purchase_order_valid(self):
def test_valid(self):
self.potest1.button_confirm() self.potest1.button_confirm()
self.assertFalse(self.potest1.exception_ids) self.assertFalse(self.potest1.exception_ids)
def test_purchase_order_exception_invalid_amt_total(self):
def test_fail_by_py(self):
self.exception_amount_total = self.env["exception.rule"].create( self.exception_amount_total = self.env["exception.rule"].create(
{ {
"name": "Min order except", "name": "Min order except",
@ -63,21 +63,21 @@ class TestBaseException(common.SavepointCase):
self.potest1.button_confirm() self.potest1.button_confirm()
self.assertTrue(self.potest1.exception_ids) self.assertTrue(self.potest1.exception_ids)
def test_purchase_order_exception_invalid_partner_zip(self):
def test_fail_by_domain(self):
self.exception_partner_no_zip = self.env["exception.rule"].create( self.exception_partner_no_zip = self.env["exception.rule"].create(
{ {
"name": "No ZIP code on destination", "name": "No ZIP code on destination",
"sequence": 10, "sequence": 10,
"model": "base.exception.test.purchase", "model": "base.exception.test.purchase",
"code": "if not obj.partner_id.zip: failed=True",
"exception_type": "by_py_code",
"domain": "[('partner_id.zip', '=', False)]",
"exception_type": "by_domain",
} }
) )
with self.assertRaises(ValidationError): with self.assertRaises(ValidationError):
self.potest1.button_confirm() self.potest1.button_confirm()
self.assertTrue(self.potest1.exception_ids) self.assertTrue(self.potest1.exception_ids)
def test_purchase_order_exception_name(self):
def test_fail_by_method(self):
self.exception_no_name = self.env["exception.rule"].create( self.exception_no_name = self.env["exception.rule"].create(
{ {
"name": "No name", "name": "No name",
@ -108,6 +108,6 @@ class TestBaseException(common.SavepointCase):
# Test that we have linked exceptions # Test that we have linked exceptions
self.assertTrue(self.potest1.exception_ids) self.assertTrue(self.potest1.exception_ids)
# Test ignore exeception make possible for the po to validate # Test ignore exeception make possible for the po to validate
self.potest1.ignore_exception = True
self.potest1.action_ignore_exceptions()
self.potest1.button_confirm() self.potest1.button_confirm()
self.assertTrue(self.potest1.state == "purchase") self.assertTrue(self.potest1.state == "purchase")
Loading…
Cancel
Save