diff --git a/fs_attachment/tests/test_fs_attachment.py b/fs_attachment/tests/test_fs_attachment.py index e4c70fa320..051646fe71 100644 --- a/fs_attachment/tests/test_fs_attachment.py +++ b/fs_attachment/tests/test_fs_attachment.py @@ -51,9 +51,17 @@ def test_create_attachment_with_meaningful_name(self): # The storage root is NOT part of the store_fname self.assertFalse("tmp/" in attachment.store_fname) + with attachment.open("rb") as f: + file_content = f.read() + self.assertEqual(file_content, content) + + new_content = b"new content" + with attachment.open("wb") as f: + f.write(new_content) # we can read the file, so storage finds it correctly with attachment.open("rb") as f: - self.assertEqual(f.read(), content) + file_content = f.read() + self.assertEqual(file_content, new_content) def test_open_attachment_in_db(self): self.env["ir.config_parameter"].sudo().set_param("ir_attachment.location", "db")