|
|
@ -42,7 +42,7 @@ class AttachmentExtensionTestCase(common.TransactionCase): |
|
|
|
def tearDown(self): |
|
|
|
super(AttachmentExtensionTestCase, self).tearDown() |
|
|
|
|
|
|
|
def test_attachment_extension(self): |
|
|
|
def test_attachment_extension_filename(self): |
|
|
|
with closing(open(os.path.join(_path, 'tests/data/sample.png'), 'r')) as file: |
|
|
|
self.sample = self.attachment_model.create({ |
|
|
|
'name': "test", |
|
|
@ -51,6 +51,14 @@ class AttachmentExtensionTestCase(common.TransactionCase): |
|
|
|
}) |
|
|
|
self.assertEqual(self.sample.extension, ".png") |
|
|
|
|
|
|
|
def test_attachment_extension_bianry(self): |
|
|
|
with closing(open(os.path.join(_path, 'tests/data/sample.png'), 'r')) as file: |
|
|
|
self.sample = self.attachment_model.create({ |
|
|
|
'name': "test", |
|
|
|
'datas': base64.encodestring(file.read()), |
|
|
|
}) |
|
|
|
self.assertEqual(self.sample.extension, ".png") |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|