changeset 3383:779f2ab6cb91

test_EmbedObject: add a test to check all major mimetype
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 20 Mar 2008 23:14:56 +0100
parents dd7df6fe929a
children 475f8094a65f
files MoinMoin/macro/_tests/test_EmbedObject.py
diffstat 1 files changed, 26 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/macro/_tests/test_EmbedObject.py	Thu Mar 20 22:51:04 2008 +0100
+++ b/MoinMoin/macro/_tests/test_EmbedObject.py	Thu Mar 20 23:14:56 2008 +0100
@@ -7,7 +7,7 @@
 
     @license: GNU GPL, see COPYING for details.
 """
-import os
+import os, py
 from MoinMoin import macro
 from MoinMoin.action import AttachFile
 from MoinMoin.macro import EmbedObject
@@ -25,6 +25,18 @@
         filename = 'test.ogg'
         filecontent = u'vorbis'
         AttachFile.add_attachment(self.request, self.pagename, filename, filecontent, overwrite=0)
+        filename = 'test.svg'
+        filecontent = u'SVG'
+        AttachFile.add_attachment(self.request, self.pagename, filename, filecontent, overwrite=0)
+        filename = 'test.mpg'
+        filecontent = u'MPG'
+        AttachFile.add_attachment(self.request, self.pagename, filename, filecontent, overwrite=0)
+        filename = 'test.pdf'
+        filecontent = u'PDF'
+        AttachFile.add_attachment(self.request, self.pagename, filename, filecontent, overwrite=0)
+        filename = 'test.mp3'
+        filecontent = u'MP3'
+        AttachFile.add_attachment(self.request, self.pagename, filename, filecontent, overwrite=0)
         self.shouldDeleteTestPage = True
 
     def teardown_class(self):
@@ -55,6 +67,19 @@
         assert body is not None
         self.request.reset()
         self.page.saveText(body, 0)
+        
+    def testEmbedObjectMimetype(self):
+        """ tests defined mimetyes """
+        files = ('test.ogg', 'test.svg', 'test.mpg', 'test.mp3')
+        mimetype = ('application/ogg', 'image/svg+xml', 'video/mpeg', 'audio/mpeg')
+        index = 0
+        for filename in files:
+            text = '= %s =' % filename
+            self._createTestPage(text)
+            m = self._make_macro()
+            result = m.execute('EmbedObject', u'%s' % filename)
+            assert mimetype[index] in result
+            index += 1
 
     def testEmbedObjectDefaultValues(self):
         """ tests default values of macro EmbedObject """