Browse Source

[IMP] Code coverage

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

2
base_exception/__manifest__.py

@ -10,7 +10,7 @@
This module provide an abstract model to manage customizable
exceptions to be applied on different models (sale order, invoice, ...)""",
"author": "Akretion, Sodexis, Camptocamp, "
"Odoo Community Association (OCA)",
"Odoo Community Association (OCA)",
"website": "https://github.com/OCA/server-tools",
"depends": ["base_setup"],
"license": "AGPL-3",

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.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(
{
"name": "Min order except",
@ -63,21 +63,21 @@ class TestBaseException(common.SavepointCase):
self.potest1.button_confirm()
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(
{
"name": "No ZIP code on destination",
"sequence": 10,
"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):
self.potest1.button_confirm()
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(
{
"name": "No name",
@ -108,6 +108,6 @@ class TestBaseException(common.SavepointCase):
# Test that we have linked exceptions
self.assertTrue(self.potest1.exception_ids)
# 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.assertTrue(self.potest1.state == "purchase")
Loading…
Cancel
Save