|
1 | 1 | # -*- coding: utf-8 -*- |
2 | | -from bs4 import BeautifulSoup |
3 | 2 | from collections import OrderedDict |
4 | 3 | from collective.contact.plonegroup.config import get_registry_organizations |
5 | 4 | from collective.documentviewer.convert import Converter |
|
26 | 25 | from imio.dms.mail.utils import IdmUtilsMethods |
27 | 26 | from imio.dms.mail.utils import invalidate_users_groups |
28 | 27 | from imio.dms.mail.utils import list_wf_states |
| 28 | +from imio.dms.mail.utils import PREVIEW_DIR |
29 | 29 | from imio.dms.mail.utils import set_dms_config |
30 | 30 | from imio.dms.mail.utils import sub_create |
31 | 31 | from imio.dms.mail.utils import update_transitions_auc_config |
|
46 | 46 | from zope.annotation.interfaces import IAnnotations |
47 | 47 | from zope.component import getUtility |
48 | 48 | from zope.intid.interfaces import IIntIds |
49 | | -from zope.schema.interfaces import IVocabularyFactory |
50 | 49 |
|
51 | 50 | import os |
52 | 51 | import unittest |
@@ -1006,16 +1005,16 @@ def test_eml_preview(self): |
1006 | 1005 | ) |
1007 | 1006 | annot = IAnnotations(dmsmainfile) |
1008 | 1007 | self.assertNotIn("successfully_converted", annot) |
1009 | | - |
1010 | 1008 | eml_preview(dmsmainfile) |
1011 | 1009 | annot = IAnnotations(dmsmainfile)["collective.documentviewer"] |
1012 | | - |
1013 | | - self.assertIn("successfully_converted", annot) |
1014 | | - |
1015 | 1010 | self.assertEqual(annot["num_pages"], 1) |
1016 | 1011 | self.assertEqual(annot["successfully_converted"], True) |
1017 | | - |
1018 | 1012 | self.assertEqual( |
1019 | 1013 | [k for k in annot["blob_files"].keys()], |
1020 | 1014 | ["large/dump_1.jpg", "normal/dump_1.jpg", "small/dump_1.jpg"], |
1021 | 1015 | ) |
| 1016 | + blobs = [bl for bl in annot["blob_files"].values()] |
| 1017 | + self.assertEqual(blobs[0], blobs[1]) |
| 1018 | + with open(os.path.join(PREVIEW_DIR, "previsualisation_eml_normal.jpg"), 'rb') as f1, \ |
| 1019 | + open(blobs[0]._p_blob_uncommitted, 'rb') as f2: |
| 1020 | + self.assertEqual(f1.read(), f2.read()) |
0 commit comments