Mathias 7 years ago
parent
commit
fb832769ea
  1. 4
      muk_web_preview_attachment/tests/test_attachment_extension.py
  2. 2
      muk_web_preview_mail/tests/test_mail_parse.py

4
muk_web_preview_attachment/tests/test_attachment_extension.py

@ -43,7 +43,7 @@ class AttachmentExtensionTestCase(common.TransactionCase):
super(AttachmentExtensionTestCase, self).tearDown() super(AttachmentExtensionTestCase, self).tearDown()
def test_attachment_extension_filename(self): def test_attachment_extension_filename(self):
with closing(open(os.path.join(_path, 'tests/data/sample.png'), 'r')) as file:
with closing(open(os.path.join(_path, 'tests/data/sample.png'), 'rb')) as file:
self.sample = self.attachment_model.create({ self.sample = self.attachment_model.create({
'name': "test", 'name': "test",
'datas_fname': "sample.png", 'datas_fname': "sample.png",
@ -52,7 +52,7 @@ class AttachmentExtensionTestCase(common.TransactionCase):
self.assertEqual(self.sample.extension, ".png") self.assertEqual(self.sample.extension, ".png")
def test_attachment_extension_mimetype(self): def test_attachment_extension_mimetype(self):
with closing(open(os.path.join(_path, 'tests/data/sample.png'), 'r')) as file:
with closing(open(os.path.join(_path, 'tests/data/sample.png'), 'rb')) as file:
self.sample = self.attachment_model.create({ self.sample = self.attachment_model.create({
'name': "test", 'name': "test",
'mimetype': "image/png", 'mimetype': "image/png",

2
muk_web_preview_mail/tests/test_mail_parse.py

@ -40,7 +40,7 @@ class MailParseTestCase(common.TransactionCase):
def setUp(self): def setUp(self):
super(MailParseTestCase, self).setUp() super(MailParseTestCase, self).setUp()
self.attachment_model = self.env['ir.attachment'].sudo() self.attachment_model = self.env['ir.attachment'].sudo()
with closing(open(os.path.join(_path, 'tests/data/sample.eml'), 'r')) as file:
with closing(open(os.path.join(_path, 'tests/data/sample.eml'), 'rb')) as file:
self.sample_mail_attachment = self.attachment_model.create({ self.sample_mail_attachment = self.attachment_model.create({
'name': 'SampleMail', 'name': 'SampleMail',
'datas_fname': "sample.eml", 'datas_fname': "sample.eml",

Loading…
Cancel
Save