diff options
| author | Christophe Simonis <chs@odoo.com> | 2019-02-21 15:37:19 +0100 |
|---|---|---|
| committer | Christophe Simonis <chs@odoo.com> | 2019-02-21 15:37:19 +0100 |
| commit | 1d2b6f1bef6af13245d29d56cbb5f9d61f9ca038 (patch) | |
| tree | 8ea1d203aef83d287de9ec578f81bd64eedb7359 /odoo/addons/test_testing_utilities/tests/test_form_impl.py | |
| parent | f945b1bcc21621cfc056e40f4d66b7181d19239e (diff) | |
| parent | 84143a34b313c01b0b37b7d7246ce3d5c9476002 (diff) | |
[MERGE] forward port branch 12.0 up to 84143a34b31
Diffstat (limited to 'odoo/addons/test_testing_utilities/tests/test_form_impl.py')
| -rw-r--r-- | odoo/addons/test_testing_utilities/tests/test_form_impl.py | 26 |
1 files changed, 14 insertions, 12 deletions
diff --git a/odoo/addons/test_testing_utilities/tests/test_form_impl.py b/odoo/addons/test_testing_utilities/tests/test_form_impl.py index e2f0d0d89d3..344ae62f4d2 100644 --- a/odoo/addons/test_testing_utilities/tests/test_form_impl.py +++ b/odoo/addons/test_testing_utilities/tests/test_form_impl.py @@ -24,7 +24,7 @@ class TestBasic(TransactionCase): self.assertEqual(f.f3, 21) self.assertEqual(f.f4, 42) - f.f1 = 4 + f.f1 = '4' self.assertEqual(f.f2, 42) self.assertEqual(f.f3, 21) self.assertEqual(f.f4, 10) @@ -36,7 +36,7 @@ class TestBasic(TransactionCase): r = f.save() self.assertEqual( (r.f1, r.f2, r.f3, r.f4), - (4, 8, 4, 2), + ('4', 8, 4, 2), ) def test_required(self): @@ -45,12 +45,12 @@ class TestBasic(TransactionCase): with self.assertRaisesRegexp(AssertionError, 'f1 is a required field'): f.save() # set f1 and unset f2 => should work - f.f1 = 1 + f.f1 = '1' f.f2 = False r = f.save() self.assertEqual( (r.f1, r.f2, r.f3, r.f4), - (1, 0, 0, 0) + ('1', 0, 0, 0) ) def test_readonly(self): @@ -61,7 +61,7 @@ class TestBasic(TransactionCase): f = Form(self.env['test_testing_utilities.readonly']) with self.assertRaises(AssertionError): - f.f1 = 5 + f.f1 = '5' with self.assertRaises(AssertionError): f.f2 = 42 @@ -70,7 +70,7 @@ class TestBasic(TransactionCase): """ f = Form(self.env['test_testing_utilities.a'], view='test_testing_utilities.non_normalized_attrs') - f.f1 = 1 + f.f1 = '1' f.f2 = 987 self.assertEqual(f.f5, 987) self.assertEqual(f.f6, 987) @@ -86,7 +86,7 @@ class TestBasic(TransactionCase): # not readonly yet, should work f.f2 = 5 # make f2 readonly - f.f1 = 63 + f.f1 = '63' f.f3 = 5 with self.assertRaises(AssertionError): f.f2 = 6 @@ -101,9 +101,9 @@ class TestM2O(TransactionCase): f = Form(self.env['test_testing_utilities.d']) - self.assertEqual( - f.f, a, - "The default value for the m2o should be the first Sub record" + self.assertFalse( + f.f, + "The default value gets overridden by the onchange" ) f.f2 = "B" self.assertEqual( @@ -271,6 +271,7 @@ class TestO2M(TransactionCase): [get(s) for s in r.subs], [("2", 2, 2), ("2", 2, 2)] ) + self.assertEqual(r.v, 5) with Form(r, view='test_testing_utilities.o2m_parent') as f: with f.subs.new() as sub: @@ -286,6 +287,7 @@ class TestO2M(TransactionCase): [get(s) for s in r.subs], [("2", 2, 2), ("5", 5, 5), ("2", 2, 2)] ) + self.assertEqual(r.v, 10) with Form(r, view='test_testing_utilities.o2m_parent') as f, \ f.subs.edit(index=0) as sub,\ @@ -439,12 +441,12 @@ class TestEdition(TransactionCase): """ def test_trivial(self): r = self.env['test_testing_utilities.a'].create({ - 'f1': 5, + 'f1': '5', }) with Form(r) as f: self.assertEqual(f.id, r.id) - self.assertEqual(f.f1, 5) + self.assertEqual(f.f1, '5') self.assertEqual(f.f4, 8) f.f2 = 5 |
