Commit b11198dd authored by Rafael Monnerat's avatar Rafael Monnerat 👻

Updade minor changes at the tests

All minor changes are fixes to follow up changes from external sources.
LibreOffice and Imagemagick in this case.
parent f5c37fc5
...@@ -52,7 +52,7 @@ class TestHandler(HandlerTestCase): ...@@ -52,7 +52,7 @@ class TestHandler(HandlerTestCase):
handler = Handler(self.tmp_url, png_file, "png", **self.kw) handler = Handler(self.tmp_url, png_file, "png", **self.kw)
metadata = handler.getMetadata() metadata = handler.getMetadata()
self.assertEquals(metadata.get("Compression"), "Zip") self.assertEquals(metadata.get("Compression"), "Zip")
self.assertEquals(metadata.get("Colorspace"), "RGB") self.assertEquals(metadata.get("Colorspace"), "sRGB")
self.assertEquals(metadata.get("Matte color"), "grey74") self.assertEquals(metadata.get("Matte color"), "grey74")
def testsetMetadata(self): def testsetMetadata(self):
......
...@@ -44,9 +44,10 @@ class TestLegacyInterface(TestCase): ...@@ -44,9 +44,10 @@ class TestLegacyInterface(TestCase):
None, None,
None, None,
'text/html') 'text/html')
self.assertEquals(response_dict['mime'], 'text/html')
self.assertEquals(self._getFileType(decodestring(response_dict['data'])), self.assertEquals(self._getFileType(decodestring(response_dict['data'])),
'text/html') 'text/html')
self.assertEquals(response_dict['mime'], 'text/html')
def testHtmlToOdt(self): def testHtmlToOdt(self):
"""Check conversion of HTML to odt""" """Check conversion of HTML to odt"""
...@@ -58,9 +59,10 @@ class TestLegacyInterface(TestCase): ...@@ -58,9 +59,10 @@ class TestLegacyInterface(TestCase):
None, None,
'odt', 'odt',
'text/html') 'text/html')
self.assertEquals(response_dict['mime'], 'application/vnd.oasis.opendocument.text')
self.assertEquals(self._getFileType(decodestring(response_dict['data'])), self.assertEquals(self._getFileType(decodestring(response_dict['data'])),
'application/vnd.oasis.opendocument.text') 'application/vnd.oasis.opendocument.text')
self.assertEquals(response_dict['mime'], 'application/vnd.oasis.opendocument.text')
def test_suite(): def test_suite():
return make_suite(TestLegacyInterface) return make_suite(TestLegacyInterface)
...@@ -46,8 +46,8 @@ class TestServer(TestCase): ...@@ -46,8 +46,8 @@ class TestServer(TestCase):
# XXX Duplicated list of filters # XXX Duplicated list of filters
self.text_expected_list = [['doc', 'Microsoft Word 6.0'], self.text_expected_list = [['doc', 'Microsoft Word 6.0'],
['doc', 'Microsoft Word 95'], ['doc', 'Microsoft Word 95'],
['doc', 'Microsoft Word 97/2000/XP'], ['doc', 'Microsoft Word 97/2000/XP/2003'],
['docx', 'Microsoft Word 2007 XML'], ['docx', 'Microsoft Word 2007/2010 XML'],
['docx', 'Office Open XML Text'], ['docx', 'Office Open XML Text'],
['htm', 'HTML Document (OpenOffice.org Writer)'], ['htm', 'HTML Document (OpenOffice.org Writer)'],
['html', 'HTML Document (OpenOffice.org Writer)'], ['html', 'HTML Document (OpenOffice.org Writer)'],
...@@ -78,10 +78,11 @@ class TestServer(TestCase): ...@@ -78,10 +78,11 @@ class TestServer(TestCase):
['pdf', 'PDF - Portable Document Format'], ['pdf', 'PDF - Portable Document Format'],
['pgm', 'PGM - Portable Graymap'], ['pict', 'PCT - Mac Pict'], ['pgm', 'PGM - Portable Graymap'], ['pict', 'PCT - Mac Pict'],
['png', 'PNG - Portable Network Graphic'], ['png', 'PNG - Portable Network Graphic'],
['pot', 'Microsoft PowerPoint 97/2000/XP Template'], ['pot', 'Microsoft PowerPoint 97/2000/XP/2003 Template'],
['ppm', 'PPM - Portable Pixelmap'], ['ppm', 'PPM - Portable Pixelmap'],
['pps', 'Microsoft PowerPoint 97/2000/XP'], ['pps', 'Microsoft PowerPoint 97/2000/XP'],
['ppt', 'Microsoft PowerPoint 97/2000/XP'], ['ppt', 'Microsoft PowerPoint 97/2000/XP/2003'],
['pps', 'Microsoft PowerPoint 97/2000/XP/2003 AutoPlay'],
['ras', 'RAS - Sun Raster Image'], ['ras', 'RAS - Sun Raster Image'],
['sda', 'StarDraw 5.0 (OpenOffice.org Impress)'], ['sda', 'StarDraw 5.0 (OpenOffice.org Impress)'],
['sdd', 'StarDraw 3.0 (OpenOffice.org Impress)'], ['sdd', 'StarDraw 3.0 (OpenOffice.org Impress)'],
...@@ -189,12 +190,12 @@ class TestServer(TestCase): ...@@ -189,12 +190,12 @@ class TestServer(TestCase):
(join('data', 'testMetadata.odt'), "odt", dict(Data='', Title='clo'+ (join('data', 'testMetadata.odt'), "odt", dict(Data='', Title='clo'+
'udooo Test', Subject='Subject Test', Description='cloudooo Comments', 'udooo Test', Subject='Subject Test', Description='cloudooo Comments',
Type='Text', MIMEType='application/vnd.oasis.opendocument.text', Type='Text', MIMEType='application/vnd.oasis.opendocument.text',
ModifyDate='2/8/2010 9:57:3', Keywords='Keywords Test')), Keywords='Keywords Test')),
# Test method getFileMetadataItemList. With data converted # Test method getFileMetadataItemList. With data converted
(join('data', 'testMetadata.odt'), "odt", dict(Title='cloudooo Test', (join('data', 'testMetadata.odt'), "odt", dict(Title='cloudooo Test',
Subject='Subject Test', Description='cloudooo Comments', Subject='Subject Test', Description='cloudooo Comments',
Type='Text', MIMEType='application/vnd.oasis.opendocument.text', Type='Text', MIMEType='application/vnd.oasis.opendocument.text',
ModifyDate='2/8/2010 9:57:3', Keywords='Keywords Test'), Keywords='Keywords Test'),
True), True),
] ]
...@@ -425,14 +426,11 @@ class TestServer(TestCase): ...@@ -425,14 +426,11 @@ class TestServer(TestCase):
list_for_mimetype = [['html', 'HTML Document (OpenOffice.org Writer)'], list_for_mimetype = [['html', 'HTML Document (OpenOffice.org Writer)'],
['txt', 'Text Encoded'], ['txt', 'Text Encoded'],
['doc', 'Microsoft Word 6.0'], ['doc', 'Microsoft Word 6.0'],
['sdw', 'StarWriter 3.0'],
['sdw', 'StarWriter 5.0'],
['doc', 'Microsoft Word 95'], ['doc', 'Microsoft Word 95'],
['doc', 'Microsoft Word 97/2000/XP'], ['doc', 'Microsoft Word 97/2000/XP/2003'],
['ott', 'ODF Text Document Template'], ['ott', 'ODF Text Document Template'],
['sdw', 'StarWriter 4.0'],
['rtf', 'Rich Text Format'], ['rtf', 'Rich Text Format'],
['docx', 'Microsoft Word 2007 XML'], ['docx', 'Microsoft Word 2007/2010 XML'],
['sxw', 'OpenOffice.org 1.0 Text Document'], ['sxw', 'OpenOffice.org 1.0 Text Document'],
['txt', 'Text Encoded'], ['txt', 'Text Encoded'],
['docx', 'Office Open XML Text'], ['docx', 'Office Open XML Text'],
...@@ -538,10 +536,10 @@ class TestServer(TestCase): ...@@ -538,10 +536,10 @@ class TestServer(TestCase):
"""Test if getImageItemList can get the list of images items from odt file""" """Test if getImageItemList can get the list of images items from odt file"""
data = encodestring(open("./data/granulate_test.odt").read()) data = encodestring(open("./data/granulate_test.odt").read())
image_list = self.proxy.getImageItemList(data, "odt") image_list = self.proxy.getImageItemList(data, "odt")
self.assertEquals([['10000000000000C80000009C38276C51.jpg', ''], self.assertEquals([['10000000000000C80000009CA3D5C3B7.jpg', ''],
['10000201000000C80000004E7B947D46.png', 'TioLive Logo'], ['10000201000000C80000004E7B947D46.png', 'TioLive Logo'],
['10000201000000C80000004E7B947D46.png', ''], ['10000201000000C80000004E7B947D46.png', ''],
['2000004F00004233000013707E7DE37A.svm', 'Python Logo'], ['2000004F0000423300001370A30E6D5A.svm', 'Python Logo'],
['10000201000000C80000004E7B947D46.png', ['10000201000000C80000004E7B947D46.png',
'Again TioLive Logo']], 'Again TioLive Logo']],
image_list) image_list)
...@@ -550,7 +548,7 @@ class TestServer(TestCase): ...@@ -550,7 +548,7 @@ class TestServer(TestCase):
"""Test if getImageItemList can get the list of images items from doc file""" """Test if getImageItemList can get the list of images items from doc file"""
data = encodestring(open("./data/granulate_test.doc").read()) data = encodestring(open("./data/granulate_test.doc").read())
image_list = self.proxy.getImageItemList(data, "doc") image_list = self.proxy.getImageItemList(data, "doc")
self.assertEquals([['10000000000000C80000009C38276C51.jpg', ''], self.assertEquals([['10000000000000C80000009CA3D5C3B7.jpg', ''],
['10000201000000C80000004E7B947D46.png', 'TioLive Logo'], ['10000201000000C80000004E7B947D46.png', 'TioLive Logo'],
['10000201000000C80000004E7B947D46.png', ''], ['10000201000000C80000004E7B947D46.png', ''],
['200003160000423300001370F468B63D.wmf', 'Python Logo'], ['200003160000423300001370F468B63D.wmf', 'Python Logo'],
...@@ -562,7 +560,7 @@ class TestServer(TestCase): ...@@ -562,7 +560,7 @@ class TestServer(TestCase):
"""Test if getImage can get a image from odt file after zip""" """Test if getImage can get a image from odt file after zip"""
data = encodestring(open("./data/granulate_test.odt").read()) data = encodestring(open("./data/granulate_test.odt").read())
zip = ZipFile(StringIO(decodestring(data))) zip = ZipFile(StringIO(decodestring(data)))
image_id = '10000000000000C80000009C38276C51.jpg' image_id = '10000201000000C80000004E7B947D46.png'
original_image = zip.read('Pictures/%s' % image_id) original_image = zip.read('Pictures/%s' % image_id)
geted_image = decodestring(self.proxy.getImage(data, image_id, "odt")) geted_image = decodestring(self.proxy.getImage(data, image_id, "odt"))
self.assertEquals(original_image, geted_image) self.assertEquals(original_image, geted_image)
...@@ -574,7 +572,7 @@ class TestServer(TestCase): ...@@ -574,7 +572,7 @@ class TestServer(TestCase):
#so compare with the server return. #so compare with the server return.
data_odt = self.proxy.convertFile(data, 'doc', 'odt', False) data_odt = self.proxy.convertFile(data, 'doc', 'odt', False)
zip = ZipFile(StringIO(decodestring(data_odt))) zip = ZipFile(StringIO(decodestring(data_odt)))
image_id = '10000000000000C80000009C38276C51.jpg' image_id = '10000000000000C80000009CA3D5C3B7.jpg'
original_image = zip.read('Pictures/%s' % image_id) original_image = zip.read('Pictures/%s' % image_id)
geted_image = decodestring(self.proxy.getImage(data, image_id, "doc")) geted_image = decodestring(self.proxy.getImage(data, image_id, "doc"))
self.assertEquals(original_image, geted_image) self.assertEquals(original_image, geted_image)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment