~ubuntu-branches/ubuntu/natty/moin/natty-updates

« back to all changes in this revision

Viewing changes to MoinMoin/macro/_tests/test_Action.py

  • Committer: Bazaar Package Importer
  • Author(s): Jonas Smedegaard
  • Date: 2008-06-22 21:17:13 UTC
  • mfrom: (0.9.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20080622211713-fpo2zrq3s5dfecxg
Tags: 1.7.0-3
Simplify /etc/moin/wikilist format: "USER URL" (drop unneeded middle
CONFIG_DIR that was wrongly advertised as DATA_DIR).  Make
moin-mass-migrate handle both formats and warn about deprecation of
the old one.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
# -*- coding: utf-8 -*-
 
2
"""
 
3
    MoinMoin - MoinMoin.macro.Action Tests
 
4
 
 
5
    @copyright: 2007 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 Action
 
12
from MoinMoin.Page import Page
 
13
from MoinMoin.PageEditor import PageEditor
 
14
 
 
15
from MoinMoin._tests import become_trusted, create_page, nuke_page
 
16
 
 
17
class TestAction:
 
18
    """ testing macro Action calling action raw """
 
19
    pagename = u'AutoCreatedMoinMoinTemporaryTestPageForAction'
 
20
 
 
21
    def _make_macro(self):
 
22
        """Test helper"""
 
23
        from MoinMoin.parser.text import Parser
 
24
        from MoinMoin.formatter.text_html import Formatter
 
25
        p = Parser("##\n", self.request)
 
26
        p.formatter = Formatter(self.request)
 
27
        p.formatter.page = self.page
 
28
        self.request.formatter = p.formatter
 
29
        p.form = self.request.form
 
30
        m = macro.Macro(p)
 
31
        return m
 
32
 
 
33
    def testActionCallingRaw(self):
 
34
        """ module_tested: executes raw by macro Action on existing page"""
 
35
        request = self.request
 
36
        become_trusted(request)
 
37
 
 
38
        self.page = create_page(request, self.pagename, u'= title1 =\n||A||B||\n')
 
39
        m = self._make_macro()
 
40
        result = Action.macro_Action(m, 'raw')
 
41
        nuke_page(request, self.pagename)
 
42
 
 
43
        expected = '<a href="./AutoCreatedMoinMoinTemporaryTestPageForAction?action=raw">raw</a>'
 
44
        assert result == expected
 
45
 
 
46
 
 
47
coverage_modules = ['MoinMoin.macro.Action']
 
48