details:   https://code.tryton.org/tryton/commit/774101ce9dfe
branch:    7.8
user:      Cédric Krier <[email protected]>
date:      Thu Dec 25 09:54:24 2025 +0100
description:
        Use ID read of note in tests

        Closes #14450
        (grafted from fc9585e7f01e1da884bb182e8cf6069e0f245c7c)
diffstat:

 trytond/trytond/tests/test_resource.py |  24 ++++++++++++------------
 1 files changed, 12 insertions(+), 12 deletions(-)

diffs (60 lines):

diff -r 0876107a7360 -r 774101ce9dfe trytond/trytond/tests/test_resource.py
--- a/trytond/trytond/tests/test_resource.py    Wed Dec 24 11:38:45 2025 +0100
+++ b/trytond/trytond/tests/test_resource.py    Thu Dec 25 09:54:24 2025 +0100
@@ -125,13 +125,13 @@
         record, = Resource.create([{}])
 
         with Transaction().set_context(_check_access=True):
-            note_id, = Note.create([{
+            note, = Note.create([{
                         'resource': record,
                         'message': "Foo",
                         }])
-            Note.write([note_id], {'message': "Bar"})
-            Note.read([note_id], ['message'])
-            Note.delete([note_id])
+            Note.write([note], {'message': "Bar"})
+            Note.read([note.id], ['message'])
+            Note.delete([note])
 
     @with_transaction()
     def test_resource_without_access(self):
@@ -189,13 +189,13 @@
         record, = Resource.create([{}])
 
         with Transaction().set_context(_check_access=True):
-            note_id, = Note.create([{
+            note, = Note.create([{
                         'resource': record,
                         'message': "Foo",
                         }])
-            Note.write([note_id], {'message': "Bar"})
-            Note.read([note_id], ['message'])
-            Note.delete([note_id])
+            Note.write([note], {'message': "Bar"})
+            Note.read([note.id], ['message'])
+            Note.delete([note])
 
     @with_transaction()
     def test_resource_without_rule(self):
@@ -217,7 +217,7 @@
                     }])
         record, = Resource.create([{}])
 
-        note_id, = Note.create([{
+        note, = Note.create([{
                     'resource': record,
                     'message': "Message",
                     }])
@@ -230,8 +230,8 @@
                             }])
 
             with self.assertRaises(AccessError):
-                Note.write([note_id], {'message': "Bar"})
+                Note.write([note], {'message': "Bar"})
             with self.assertRaises(AccessError):
-                Note.read([note_id], ['message'])
+                Note.read([note.id], ['message'])
             with self.assertRaises(AccessError):
-                Note.delete([note_id])
+                Note.delete([note])

Reply via email to