Back to index

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

List of all members.

Public Member Functions

def testLinkFormating
def testLinkAttachment
def testLinkAttachmentImage
def testAnchor
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 353 of file

Member Function Documentation

def test_text_creole.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 = page
00043         parser = CreoleParser(body, request, line_anchors=False)
00044         formatter.startContent('') # needed for _include_stack init
00045         output = request.redirectedOutput(parser.format, formatter)
00046         formatter.endContent('')
00047         return output

Here is the call graph for this function:

Definition at line 398 of file

00399     def testAnchor(self):
00400         html = self.parse("{{#anchor}}")
00401         assert 'id="anchor"' in html

Here is the call graph for this function:

Definition at line 382 of file

00383     def testLinkAttachment(self):
00384         html = self.parse("[[attachment:some file.txt]]")
00385         assert '<a ' in html
00386         assert 'href="' in html
00387         assert 'class="attachment nonexistent"' in html
00388         assert 'action=AttachFile' in html
00389         assert 'some+file.txt' in html

Here is the call graph for this function:

Definition at line 390 of file

00391     def testLinkAttachmentImage(self):
00392         html = self.parse("[[attachment:some file.png]]")
00393         assert '<a ' in html # must create a link
00394         assert 'href="' in html
00395         assert 'class="attachment nonexistent"' in html
00396         assert 'action=AttachFile' in html
00397         assert 'some+file.png' in html

Here is the call graph for this function: link formating 

Definition at line 375 of file

00376     def testLinkFormating(self):
00377         """ link formating """
00378         for test, expected in self._tests:
00379             html = self.parse(self.text % test)
00380             result =
00381             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>'),
        ('[[|google]]', '<a class="http" href="">google</a>'),

Definition at line 358 of file

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

Definition at line 357 of file

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

Definition at line 356 of file

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