Skip to content

Commit 2f89634

Browse files
committed
[FIX] tests: make test works in all versions
In `saas~12.3`, computed-stored fields are computed *after* the `INSERT` and the resulting values are stored using an `UPDATE`. This makes the assertions in the test to fail. Use `res.bank` instead of `res.partner` as this model doesn't have any computed-stored fields. Part-of: #269 Signed-off-by: Christophe Simonis (chs) <[email protected]>
1 parent d0c64ea commit 2f89634

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

src/base/tests/test_util.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2236,8 +2236,8 @@ def test_assert_updated(self):
22362236
with self.assertUpdated("res_partner", ids=[]):
22372237
p1.city = "Underground"
22382238
util.flush(p1)
2239-
with self.assertRaises(AssertionError), self.assertUpdated("res_partner", ids=[]):
2240-
self.env["res.partner"].create({"name": "Annie Leonhart"})
2239+
with self.assertRaises(AssertionError), self.assertUpdated("res_bank", ids=[]):
2240+
self.env["res.bank"].create({"name": "Annie Leonhart"})
22412241

22422242
# when ids has multiple records, all records should be updated
22432243
with self.assertUpdated("res_partner", ids=[p1.id, p2.id]):
@@ -2270,8 +2270,8 @@ def test_assert_not_updated(self):
22702270
self.env["res.partner"].create({"name": "Bertolt Hoover"})
22712271

22722272
# when ids is [], assert no record is updated
2273-
with self.assertNotUpdated("res_partner", ids=[]):
2274-
self.env["res.partner"].create({"name": "Marco Bodt"})
2273+
with self.assertNotUpdated("res_bank", ids=[]):
2274+
self.env["res.bank"].create({"name": "Marco Bodt"})
22752275
with self.assertRaises(AssertionError), self.assertNotUpdated("res_partner", ids=[]):
22762276
p2.city = "Shiganshina"
22772277
util.flush(p2)

0 commit comments

Comments
 (0)