Ejemplo n.º 1
0
 def testEmbedObjectDefaultValues(self):
     """ tests default values of macro EmbedObject """
     m = make_macro(self.request, self.page)
     filename = 'test.mpg'
     result = m.execute('EmbedObject', u'%s' % filename)
     assert '<object data="/AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=get&amp;target=test.mpg"' in result
     assert 'align="middle"' in result
     assert 'value="transparent"' in result
 def test_enumbering(self):
     """ module_tested: enumbering of Footnotes"""
     m = make_macro(self.request, self.page)
     text = 'a'
     FootNote.execute(m, text)
     text = 'b'
     FootNote.execute(m, text)
     result = FootNote.emit_footnotes(m.request, m.request.formatter)
     assert result.endswith('2</a>)</li></ol></div>')
Ejemplo n.º 3
0
 def test_enumbering(self):
     """ module_tested: enumbering of Footnotes"""
     m = make_macro(self.request, self.page)
     text = 'a'
     FootNote.execute(m, text)
     text = 'b'
     FootNote.execute(m, text)
     result = FootNote.emit_footnotes(m.request, m.request.formatter)
     assert result.endswith('2</a>)</li></ol></div>')
Ejemplo n.º 4
0
 def testEmbedObjectPercentHeight(self):
     """ tests a unit value for macro EmbedObject """
     m = make_macro(self.request, self.page)
     filename = 'test.mpg'
     height = '50 %' # also tests that space is allowed in there
     result = m.execute('EmbedObject', u'target=%s, height=%s' % (filename, height))
     assert '<object data="/AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=get&amp;target=test.mpg"' in result
     assert 'height="50%"' in result
     assert 'align="middle"' in result
Ejemplo n.º 5
0
 def testEmbedObjectFromUrl(self):
     """ tests using a URL for macro EmbedObject """
     m = make_macro(self.request, self.page)
     target = "http://localhost/%s?action=AttachFile&do=view&target=test.mpg" % self.pagename
     result = m.execute("EmbedObject", u"target=%s, url_mimetype=video/mpeg" % target)
     assert (
         '<object data="http://localhost/AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=view&amp;target=test.mpg" type="video/mpeg"'
         in result
     )
Ejemplo n.º 6
0
 def testActionCallingRaw(self):
     """ module_tested: executes raw by macro Action on existing page"""
     request = self.request
     become_trusted(request)
     self.page = create_page(request, self.pagename, u'= title1 =\n||A||B||\n')
     m = make_macro(self.request, self.page)
     result = Action.macro_Action(m, 'raw')
     nuke_page(request, self.pagename)
     expected = '<a class="action" href="/AutoCreatedMoinMoinTemporaryTestPageForAction?action=raw">raw</a>'
     assert result == expected
Ejemplo n.º 7
0
 def testActionCallingRaw(self):
     """ module_tested: executes raw by macro Action on existing page"""
     request = self.request
     become_trusted(request)
     self.page = create_page(request, self.pagename,
                             u'= title1 =\n||A||B||\n')
     m = make_macro(self.request, self.page)
     result = Action.macro_Action(m, 'raw')
     nuke_page(request, self.pagename)
     expected = '<a class="action" href="/AutoCreatedMoinMoinTemporaryTestPageForAction?action=raw">raw</a>'
     assert result == expected
Ejemplo n.º 8
0
 def testEmbedObjectMimetype(self):
     """ tests defined mimetyes """
     tests = [
         (u'test.pdf', 'application/pdf'),
         (u'test.svg', 'image/svg+xml'),
         (u'test.mpg', 'video/mpeg'),
         (u'test.mp3', 'audio/mpeg'),
     ]
     for filename, mimetype in tests:
         m = make_macro(self.request, self.page)
         result = m.execute('EmbedObject', filename)
         assert mimetype in result
Ejemplo n.º 9
0
 def testEmbedObjectMimetype(self):
     """ tests defined mimetyes """
     tests = [
         (u"test.pdf", "application/pdf"),
         (u"test.svg", "image/svg+xml"),
         (u"test.mpg", "video/mpeg"),
         (u"test.mp3", "audio/mpeg"),
     ]
     for filename, mimetype in tests:
         m = make_macro(self.request, self.page)
         result = m.execute("EmbedObject", filename)
         assert mimetype in result
Ejemplo n.º 10
0
 def _test_macro(self, name, args):
     m = make_macro(self.request, self.page)
     return m.execute(name, args)
Ejemplo n.º 11
0
 def testTrivialMacro(self):
     """macro: trivial macro works"""
     m = make_macro(self.request, self.page)
     expected = m.formatter.linebreak(0)
     result = m.execute("BR", "")
     assert result == expected
Ejemplo n.º 12
0
 def testEmbedObjectFromUrl(self):
     """ tests using a URL for macro EmbedObject """
     m = make_macro(self.request, self.page)
     target = 'http://localhost/%s?action=AttachFile&do=view&target=test.mpg' % self.pagename
     result = m.execute('EmbedObject', u'target=%s, url_mimetype=video/mpeg' % target)
     assert '<object data="http://localhost/AutoCreatedMoinMoinTemporaryTestPageForEmbedObject?action=AttachFile&amp;do=view&amp;target=test.mpg" type="video/mpeg"' in result