Back to index

moin  1.9.0~rc2
Public Member Functions | Static Public Attributes | Static Private Attributes
test_text_moin_wiki.TestLinkingMarkup Class Reference
Inheritance diagram for test_text_moin_wiki.TestLinkingMarkup:
Inheritance graph
Collaboration diagram for test_text_moin_wiki.TestLinkingMarkup:
Collaboration graph

List of all members.

Public Member Functions

def testLinkFormating
def testLinkAttachment
def testLinkAttachmentImage
def parse

Static Public Attributes

string text = 'AAA %s AAA'
tuple needle = re.compile(text % r'(.+)')

Static Private Attributes

list _tests

Detailed Description

Test wiki link markup 

Definition at line 490 of file

Member Function Documentation

def test_text_moin_wiki.ParserTestCase.parse (   self,
) [inherited]
Parse body and return html

Create a page with body, then parse it and format using html formatter

Definition at line 26 of file

00027     def parse(self, body):
00028         """Parse body and return html
00030         Create a page with body, then parse it and format using html formatter
00031         """
00032         request = self.request
00033         assert body is not None
00034         request.reset()
00035         page = Page(request, PAGENAME)
00036         page.hilite_re = None
00037         page.set_raw_body(body)
00038         formatter = HtmlFormatter(request)
00039         formatter.setPage(page)
00040         page.formatter = formatter
00041         request.formatter = formatter
00042         parser = WikiParser(body, request, line_anchors=False)
00043         formatter.startContent('') # needed for _include_stack init
00044         output = request.redirectedOutput(parser.format, formatter)
00045         formatter.endContent('')
00046         return output

Here is the call graph for this function:

Here is the caller graph for this function:

Definition at line 523 of file

00524     def testLinkAttachment(self):
00525         html = self.parse("[[attachment:some file.txt]]")
00526         assert '<a ' in html
00527         assert 'href="' in html
00528         assert 'class="attachment nonexistent"' in html
00529         assert 'action=AttachFile' in html
00530         assert 'some+file.txt' in html

Here is the call graph for this function:

Definition at line 531 of file

00532     def testLinkAttachmentImage(self):
00533         html = self.parse("[[attachment:some file.png]]")
00534         assert '<a ' in html # must create a link
00535         assert 'href="' in html
00536         assert 'class="attachment nonexistent"' in html
00537         assert 'action=AttachFile' in html
00538         assert 'some+file.png' in html

Here is the call graph for this function: link formating 

Definition at line 516 of file

00517     def testLinkFormating(self):
00518         """ link formating """
00519         for test, expected in self._tests:
00520             html = self.parse(self.text % test)
00521             result =
00522             assert result == expected

Here is the call graph for this function:

Member Data Documentation

Initial value:
        # test,           expected
        ('SomeNonExistentPage', '<a class="nonexistent" href="/SomeNonExistentPage">SomeNonExistentPage</a>'),
        ('SomeNonExistentPage#anchor', '<a class="nonexistent" href="/SomeNonExistentPage#anchor">SomeNonExistentPage#anchor</a>'),
        ('[[something]]', '<a class="nonexistent" href="/something">something</a>'),
        ('[[some thing]]', '<a class="nonexistent" href="/some%20thing">some thing</a>'),
        ('[[something|some text]]', '<a class="nonexistent" href="/something">some text</a>'),
        ('[[../something]]', '<a class="nonexistent" href="/something">../something</a>'),
        ('[[/something]]', '<a class="nonexistent" href="/%s/something">/something</a>' % PAGENAME),
        ('[[something#anchor]]', '<a class="nonexistent" href="/something#anchor">something#anchor</a>'),
        ('MoinMoin:something', '<a class="interwiki" href="" title="MoinMoin">something</a>'),
        ('[[MoinMoin:something|some text]]', '<a class="interwiki" href="" title="MoinMoin">some text</a>'),
        ('[[MoinMoin:with space]]', '<a class="interwiki" href="" title="MoinMoin">with space</a>'),
        ('[[MoinMoin:with space|some text]]', '<a class="interwiki" href="" title="MoinMoin">some text</a>'),
        # no interwiki:
        ('[[ABC:n]]', '<a class="nonexistent" href="/ABC%3An">ABC:n</a>'), # finnish/swedish abbreviations / possessive
        ('ABC:n', 'ABC:n'), # finnish/swedish abbreviations / possessive
        ('lowercase:nointerwiki', 'lowercase:nointerwiki'),
        ('[[|google]]', '<a class="http" href="">google</a>'),

Definition at line 495 of file

tuple test_text_moin_wiki.TestLinkingMarkup.needle = re.compile(text % r'(.+)') [static]

Definition at line 494 of file

string test_text_moin_wiki.TestLinkingMarkup.text = 'AAA %s AAA' [static]

Definition at line 493 of file

The documentation for this class was generated from the following file: