diff options
author | Sebastian Deiss <sebastian.deiss@atos.net> | 2017-09-01 09:57:13 +0200 |
---|---|---|
committer | Sebastian Deiss <sebastian.deiss@atos.net> | 2017-09-01 09:57:13 +0200 |
commit | ed2b2448c7c598978298172860908a12cd1464d2 (patch) | |
tree | 0ec91c98d9f553b5ab274d029bac235b0ee24bbb /test.py | |
parent | 75e17729fcf0c2175ca055acf8881793e4b324ae (diff) |
Add testcase for samples without a file extension
Diffstat (limited to 'test.py')
-rw-r--r-- | test.py | 21 |
1 files changed, 20 insertions, 1 deletions
@@ -168,7 +168,6 @@ class TestSample(unittest.TestCase): test_meta_info += 'digest :\n' test_meta_info += 'attributes :\n' test_meta_info += 'queue_id :\n' - with open('./test_meta_info.info', 'w+') as f: f.write(test_meta_info) @@ -205,6 +204,26 @@ class TestSample(unittest.TestCase): self.sample.load_meta_info('./test_meta_info.info') self.assertEqual(self.sample.file_extension, 'pyc') + + def test_sample_without_suffix(self): + test_meta_info = '[attachment]\n' + test_meta_info += 'full_name : /tmp/junk\n' + test_meta_info += 'name_declared : Report.docx\n' + test_meta_info += 'type_declared : application/vnd.openxmlformats-officedocument.wordprocessingml.document\n' + test_meta_info += 'type_long : application/vnd.openxmlformats-officedocument.wordprocessingml.document\n' + test_meta_info += 'type_short : docx\n' + test_meta_info += 'size : 212\n' + test_meta_info += 'digest :\n' + test_meta_info += 'attributes :\n' + test_meta_info += 'queue_id :\n' + with open('./junk.info', 'w+') as f: + f.write(test_meta_info) + sample = Sample(self.conf, None, 'junk') + self.assertEqual(sample.file_extension, '') + sample.load_meta_info('./junk.info') + self.assertEqual(sample.file_extension, 'docx') + os.unlink('./junk.info') + @classmethod def tearDownClass(cls): cls.conf.db_con.close() |