Skip to content

Commit

Permalink
*
Browse files Browse the repository at this point in the history
  • Loading branch information
len-foss committed Dec 13, 2023
1 parent bb64e9f commit c88a455
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion fs_attachment/tests/test_fs_attachment.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down

0 comments on commit c88a455

Please sign in to comment.