comparison MoinMoin/macro/_tests/test_FootNote.py @ 3056:b7914fb12243

macro.FootNote: bug fix for MoinMoinBugs/FootNoteNumbering (ported from 1.6)
author Reimar Bauer <rb.proj AT googlemail DOT com>
date Thu, 21 Feb 2008 19:41:15 +0100
parents
children 886b8969dbc6
comparison
equal deleted inserted replaced
3055:29d236eb2ab7 3056:b7914fb12243
1 # -*- coding: utf-8 -*-
2 """
3 MoinMoin - MoinMoin.macro.FootNote Tests
4
5 @copyright: 2008 MoinMoin:ReimarBauer
6
7 @license: GNU GPL, see COPYING for details.
8 """
9 import os
10 from MoinMoin import macro
11 from MoinMoin.macro import FootNote
12 from MoinMoin.Page import Page
13 from MoinMoin.PageEditor import PageEditor
14
15
16 class TestFootNote:
17 """ testing macro Action calling action raw """
18
19 def setup_class(self):
20 self.pagename = u'AutoCreatedMoinMoinTemporaryTestPageForFootNote'
21 self.page = PageEditor(self.request, self.pagename)
22 self.shouldDeleteTestPage = True
23
24 def teardown_class(self):
25 if self.shouldDeleteTestPage:
26 import shutil
27 page = Page(self.request, self.pagename)
28 fpath = page.getPagePath(use_underlay=0, check_create=0)
29 shutil.rmtree(fpath, True)
30
31 fpath = self.request.rootpage.getPagePath('event-log', isfile=1)
32 if os.path.exists(fpath):
33 os.remove(fpath)
34
35 def _make_macro(self):
36 """Test helper"""
37 from MoinMoin.parser.text import Parser
38 from MoinMoin.formatter.text_html import Formatter
39 p = Parser("##\n", self.request)
40 p.formatter = Formatter(self.request)
41 p.formatter.page = self.page
42 self.request.formatter = p.formatter
43 p.form = self.request.form
44 m = macro.Macro(p)
45 return m
46
47 def test_enumbering(self):
48 """ module_tested: enumbering of Footnotes"""
49 m = self._make_macro()
50 text = 'a'
51 FootNote.execute(m, text)
52 text = 'b'
53 FootNote.execute(m, text)
54 result = FootNote.emit_footnotes(m.request, m.request.formatter)
55
56 assert result.endswith('2</a>)</li></ol></div>')
57
58
59 coverage_modules = ['MoinMoin.macro.FootNote']
60