[16.0][MIG] document_url: Migration to 16.0

This commit is contained in:
FernandoRomera
2022-12-08 10:06:22 +01:00
parent 26836db54c
commit 1461f17e29
5 changed files with 18 additions and 17 deletions

View File

@@ -1,5 +1,7 @@
# License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html).
import base64
from odoo.tests import common
@@ -27,3 +29,11 @@ class TestDocumentUrl(common.TransactionCase):
self.assertEqual(attachment_added_count, 1)
attachment = self.env["ir.attachment"].search(domain)
self.assertEqual(attachment.mimetype, "application/link")
def test_dont_broke_default_compute_mimetype(self):
blob1 = b"blob1"
blob1_b64 = base64.b64encode(blob1)
attachment = self.env["ir.attachment"].create(
{"name": "a2", "datas": blob1_b64, "mimetype": "image/png"}
)
self.assertEqual(attachment.mimetype, "image/png")