[IMP] add test to check if the value of product.product_pricelist_setting was modified or deleted

This commit is contained in:
Brais Abeijón
2020-11-11 12:11:21 +01:00
parent acacebfc7b
commit 710db94d18

View File

@@ -1,3 +1,4 @@
from odoo.exceptions import ValidationError
from odoo.tests import common, tagged
@@ -7,10 +8,32 @@ class TestPmsPricelist(common.TransactionCase):
# ARRANGE
key = "product.product_pricelist_setting"
value = "Advance"
value = "advanced"
# ACT
found_value = self.env["ir.config_parameter"].sudo().get_param(key)
# ASSERT
self.assertEqual(found_value, value, "The register wasn't created")
self.assertEqual(found_value, value, "Parameter doesn't exist")
def test_product_pricelist_setting_modified(self):
# ARRANGE
key = "product.product_pricelist_setting"
value = "basic"
# ACT & ASSERT
with self.assertRaises(ValidationError), self.cr.savepoint():
self.env["ir.config_parameter"].set_param(key, value)
def test_product_pricelist_setting_unlink(self):
# ARRANGE
key = "product.product_pricelist_setting"
value = "advanced"
# ACT & ASSERT
with self.assertRaises(ValidationError), self.cr.savepoint():
self.env["ir.config_parameter"].search(
[("key", "=", key), ("value", "=", value)]
).unlink()