@@ -48,10 +48,8 @@ def test_get_param(self):
4848 # read so it's created in db
4949 value = self .ICP .get_param ("ircp_from_config" )
5050 self .assertEqual (value , "config_value" )
51- # now it's in db
52- res = self .ICP .search ([("key" , "=" , "ircp_from_config" )])
53- self .assertEqual (len (res ), 1 )
54- self .assertEqual (res .value , "config_value" )
51+ # It should not be saved in db
52+ self .assertFalse (self .ICP .search ([("key" , "=" , "ircp_from_config" )]))
5553
5654 def test_set_param_1 (self ):
5755 """We can't set parameters that are in config file"""
@@ -74,11 +72,11 @@ def test_set_param_1(self):
7472 res .unlink ()
7573 res = self .ICP .search ([("key" , "=" , "ircp_from_config" )])
7674 self .assertEqual (len (res ), 0 )
77- # but the value is recreated when getting param again
75+ # but the value should not be recreated when getting param again
7876 value = self .ICP .get_param ("ircp_from_config" )
7977 self .assertEqual (value , "config_value" )
80- res = self . ICP . search ([( "key" , "=" , "ircp_from_config" )])
81- self .assertEqual ( len ( res ), 1 )
78+ # It should not be saved in db
79+ self .assertFalse ( self . ICP . search ([( "key" , "=" , "ircp_from_config" )]) )
8280
8381 def test_set_param_2 (self ):
8482 """We can set parameters that are not in config file"""
@@ -120,27 +118,26 @@ def test_read_mail_catchall_alias(self):
120118 ):
121119 value = self .ICP .get_param ("mail.catchall.alias" )
122120 self .assertEqual (value , "my_alias" )
123- res = self .ICP .search ([("key" , "=" , "mail.catchall.alias" )])
124- self .assertEqual (len (res ), 1 )
125- self .assertEqual (res .value , "my_alias" )
121+ # It should not be saved in db
122+ self .assertFalse (self .ICP .search ([("key" , "=" , "mail.catchall.alias" )]))
126123
127124 def test_write (self ):
128125 # there's a write override, test it here
129- self ._load_xml (
130- "server_environment_ir_config_parameter" , "tests/config_param_test.xml"
131- )
132126 with self .load_config (
133127 public = self .env_config , serv_config_class = ir_config_parameter
134128 ):
129+ self ._load_xml (
130+ "server_environment_ir_config_parameter" , "tests/config_param_test.xml"
131+ )
135132 ICP = self .ICP
136133 icp1 = ICP .search ([("key" , "=" , "ircp_from_config" )])
137134 self .assertEqual (icp1 .value , "value_from_xml" )
138135 icp2 = ICP .search ([("key" , "=" , "other_ircp_from_config" )])
139136 self .assertEqual (icp2 .value , "other_value_from_xml" )
140137 # Ensures that each record has its own value at write
141138 (icp1 | icp2 ).write ({"value" : "test" })
142- self .assertEqual (icp1 .value , "config_value " )
143- self .assertEqual (icp2 .value , "other_config_value " )
139+ self .assertEqual (icp1 .value , "test " )
140+ self .assertEqual (icp2 .value , "test " )
144141 self .assertEqual (ICP .get_param (icp1 .key ), "config_value" )
145142 self .assertEqual (ICP .get_param (icp2 .key ), "other_config_value" )
146143
@@ -165,5 +162,5 @@ def test_create(self):
165162 # Ensures each record has its own value at create
166163 self .assertEqual (
167164 records .mapped ("value" ),
168- ["config_value_without_record " , "other_config_value_without_record " ],
165+ ["NOPE " , "NOPE " ],
169166 )
0 commit comments