Create record by XML for test with readonly transaction

issue10936
This commit is contained in:
Cédric Krier committed 2021-11-28 14:31:45 +01:00
1 parent 7d879abef6
commit d608167f04
3 files changed
+11 -2

No files matched your search

+9
View File
@@ -0,0 +1,9 @@
<?xml version="1.0"?>
<!-- This file is part of Tryton. The COPYRIGHT file at the top level of
this repository contains the full copyright notices and license terms. -->
<tryton>
<data>
<record model="test.function.getter_context" id="field_function_getter_context">
</record>
</data>
</tryton>
+1 -2
View File
@@ -52,8 +52,7 @@ class FieldFunctionTestCase(unittest.TestCase):
with Transaction().new_transaction(readonly=True), \
patch.object(Model, 'getter') as getter:
record = Model()
record.save()
record, = Model.search([], limit=1)
record.function_with_context
record.function_without_context
self.assertEqual(getter.call_count, 2)
+1
View File
@@ -8,4 +8,5 @@ xml:
workflow.xml
wizard.xml
modelview.xml
field_function.xml
message.xml