class TestNaviBar(object): class Config(wikiconfig.Config): interwiki_map = dict(MoinMoin='http://moinmo.in/', ) def setup_method(self, method): self.theme = ThemeSupport(app.cfg) def test_split_navilink(self): tests = [ #(navilink, (href, text, interwiki)), ('ItemName', ('/ItemName', 'ItemName', '')), ('[[ItemName|LinkText]]', ('/ItemName', 'LinkText', '')), ('MoinMoin:ItemName', ('http://moinmo.in/ItemName', 'ItemName', 'MoinMoin')), ('[[MoinMoin:ItemName|LinkText]]', ('http://moinmo.in/ItemName', 'LinkText', 'MoinMoin')), ('[[wiki:MoinMoin:ItemName|LinkText]]', ('http://moinmo.in/ItemName', 'LinkText', 'MoinMoin')), ('http://example.org/', ('http://example.org/', 'http://example.org/', '')), ('[[http://example.org/|LinkText]]', ('http://example.org/', 'LinkText', '')), ] for navilink, expected in tests: result = self.theme.split_navilink(navilink) assert result == expected
def test_location_breadcrumbs(self): test_result = ThemeSupport.location_breadcrumbs(self.theme, 'some/place/test_item') test_segment_name_1, test_item_name_1, test_item_exists_1 = test_result[0] test_segment_name_2, test_item_name_2, test_item_exists_2 = test_result[1] test_segment_name_3, test_item_name_3, test_item_exists_3 = test_result[2] assert test_segment_name_1 == 'some' assert test_item_name_1 == 'some' assert test_segment_name_2 == 'place' assert test_item_name_2 == 'some/place' assert test_segment_name_3 == 'test_item' assert test_item_name_3 == 'some/place/test_item'
def test_location_breadcrumbs(self): test_result = ThemeSupport.location_breadcrumbs(self.theme, "some/place/test_item") test_segment_name_1, test_item_name_1, test_item_exists_1 = test_result[0] test_segment_name_2, test_item_name_2, test_item_exists_2 = test_result[1] test_segment_name_3, test_item_name_3, test_item_exists_3 = test_result[2] test_segment_name_4, test_item_name_4, test_item_exists_4 = test_result[3] assert test_segment_name_1.value == "~" assert test_item_name_1.value == "" assert test_segment_name_2.value == "some" assert test_item_name_2.value == "some" assert test_segment_name_3.value == "place" assert test_item_name_3.value == "some/place" assert test_segment_name_4.value == "test_item" assert test_item_name_4.value == "some/place/test_item"
def test_location_breadcrumbs(self, theme): test_result = ThemeSupport.location_breadcrumbs(theme, 'some/place/test_item') test_segment_name_1, test_item_name_1, test_item_exists_1 = test_result[0] test_segment_name_2, test_item_name_2, test_item_exists_2 = test_result[1] test_segment_name_3, test_item_name_3, test_item_exists_3 = test_result[2] test_segment_name_4, test_item_name_4, test_item_exists_4 = test_result[3] assert test_segment_name_1.value == '~' assert test_item_name_1.value == '' assert test_segment_name_2.value == 'some' assert test_item_name_2.value == 'some' assert test_segment_name_3.value == 'place' assert test_item_name_3.value == 'some/place' assert test_segment_name_4.value == 'test_item' assert test_item_name_4.value == 'some/place/test_item'
def test_location_breadcrumbs(self, theme): test_result = ThemeSupport.location_breadcrumbs( theme, u'some/place/test_item') test_segment_name_1, test_item_name_1, test_item_exists_1 = test_result[ 0] test_segment_name_2, test_item_name_2, test_item_exists_2 = test_result[ 1] test_segment_name_3, test_item_name_3, test_item_exists_3 = test_result[ 2] assert test_segment_name_1.namespace == u'' assert test_item_name_1.namespace == u'' assert test_segment_name_1.value == 'some' assert test_item_name_1.value == 'some' assert test_segment_name_2.value == 'place' assert test_item_name_2.value == 'some/place' assert test_segment_name_3.value == 'test_item' assert test_item_name_3.value == 'some/place/test_item' test_result = ThemeSupport.location_breadcrumbs( theme, u'users/some/place/test_item') test_segment_name_1, test_item_name_1, test_item_exists_1 = test_result[ 0] test_segment_name_2, test_item_name_2, test_item_exists_2 = test_result[ 1] test_segment_name_3, test_item_name_3, test_item_exists_3 = test_result[ 2] assert test_segment_name_1.namespace == u'users' assert test_item_name_1.namespace == u'users' assert test_segment_name_1.value == u'some' assert test_item_name_1.value == u'some' assert test_segment_name_2.value == u'place' assert test_item_name_2.value == u'some/place' assert test_segment_name_3.value == u'test_item' assert test_item_name_3.value == u'some/place/test_item'
class TestNaviBar(object): class Config(wikiconfig.Config): interwiki_map = dict(Self="http://localhost:8080/", MoinMoin="http://moinmo.in/") def setup_method(self, method): self.theme = ThemeSupport(app.cfg) def test_split_navilink(self): tests = [ # (navilink, (href, text, interwiki)), ("ItemName", ("/ItemName", "ItemName", "")), ("[[ItemName|LinkText]]", ("/ItemName", "LinkText", "")), ("MoinMoin/ItemName", ("http://moinmo.in/ItemName", "ItemName", "MoinMoin")), ("[[MoinMoin/ItemName|LinkText]]", ("http://moinmo.in/ItemName", "LinkText", "MoinMoin")), ("[[wiki:MoinMoin/ItemName|LinkText]]", ("http://moinmo.in/ItemName", "LinkText", "MoinMoin")), ("http://example.org/", ("http://example.org/", "http://example.org/", "")), ("[[http://example.org/|LinkText]]", ("http://example.org/", "LinkText", "")), ] for navilink, expected in tests: result = self.theme.split_navilink(navilink) assert result == expected def test_location_breadcrumbs(self): test_result = ThemeSupport.location_breadcrumbs(self.theme, "some/place/test_item") test_segment_name_1, test_item_name_1, test_item_exists_1 = test_result[0] test_segment_name_2, test_item_name_2, test_item_exists_2 = test_result[1] test_segment_name_3, test_item_name_3, test_item_exists_3 = test_result[2] test_segment_name_4, test_item_name_4, test_item_exists_4 = test_result[3] assert test_segment_name_1.value == "~" assert test_item_name_1.value == "" assert test_segment_name_2.value == "some" assert test_item_name_2.value == "some" assert test_segment_name_3.value == "place" assert test_item_name_3.value == "some/place" assert test_segment_name_4.value == "test_item" assert test_item_name_4.value == "some/place/test_item" def test_parent_item(self): test_result = ThemeSupport.parent_item(self.theme, "moin/moin-2.0/Item") expected = "moin/moin-2.0" assert test_result == expected, 'Expected "%(expected)s" but got "%(test_result)s"' % locals()
def test_location_breadcrumbs(self, theme): test_result = ThemeSupport.location_breadcrumbs( theme, 'some/place/test_item') test_segment_name_1, test_item_name_1, test_item_exists_1 = test_result[ 0] test_segment_name_2, test_item_name_2, test_item_exists_2 = test_result[ 1] test_segment_name_3, test_item_name_3, test_item_exists_3 = test_result[ 2] test_segment_name_4, test_item_name_4, test_item_exists_4 = test_result[ 3] assert test_segment_name_1.value == '~' assert test_item_name_1.value == '' assert test_segment_name_2.value == 'some' assert test_item_name_2.value == 'some' assert test_segment_name_3.value == 'place' assert test_item_name_3.value == 'some/place' assert test_segment_name_4.value == 'test_item' assert test_item_name_4.value == 'some/place/test_item'
class TestNaviBar(object): class Config(wikiconfig.Config): interwiki_map = dict(Self='http://localhost:8080/', MoinMoin='http://moinmo.in/', ) def setup_method(self, method): self.theme = ThemeSupport(app.cfg) def test_split_navilink(self): tests = [ #(navilink, (href, text, interwiki)), ('ItemName', ('/ItemName', 'ItemName', '')), ('[[ItemName|LinkText]]', ('/ItemName', 'LinkText', '')), ('MoinMoin:ItemName', ('http://moinmo.in/ItemName', 'ItemName', 'MoinMoin')), ('[[MoinMoin:ItemName|LinkText]]', ('http://moinmo.in/ItemName', 'LinkText', 'MoinMoin')), ('[[wiki:MoinMoin:ItemName|LinkText]]', ('http://moinmo.in/ItemName', 'LinkText', 'MoinMoin')), ('http://example.org/', ('http://example.org/', 'http://example.org/', '')), ('[[http://example.org/|LinkText]]', ('http://example.org/', 'LinkText', '')), ] for navilink, expected in tests: result = self.theme.split_navilink(navilink) assert result == expected def test_location_breadcrumbs(self): test_result = ThemeSupport.location_breadcrumbs(self.theme, 'some/place/test_item') test_segment_name_1, test_item_name_1, test_item_exists_1 = test_result[0] test_segment_name_2, test_item_name_2, test_item_exists_2 = test_result[1] test_segment_name_3, test_item_name_3, test_item_exists_3 = test_result[2] assert test_segment_name_1 == 'some' assert test_item_name_1 == 'some' assert test_segment_name_2 == 'place' assert test_item_name_2 == 'some/place' assert test_segment_name_3 == 'test_item' assert test_item_name_3 == 'some/place/test_item' def test_parent_item(self): test_result = ThemeSupport.parent_item(self.theme, 'moin/moin-2.0/Item') expected = 'moin/moin-2.0' assert test_result == expected, ('Expected "%(expected)s" but got "%(test_result)s"') % locals()
def test_parent_item(self): test_result = ThemeSupport.parent_item(self.theme, 'moin/moin-2.0/Item') expected = 'moin/moin-2.0' assert test_result == expected, ('Expected "%(expected)s" but got "%(test_result)s"') % locals()
def setup_method(self, method): self.theme = ThemeSupport(app.cfg)
def test_parent_item(self): test_result = ThemeSupport.parent_item(self.theme, "moin/moin-2.0/Item") expected = "moin/moin-2.0" assert test_result == expected, 'Expected "%(expected)s" but got "%(test_result)s"' % locals()
def test_parent_item(self, theme): test_result = ThemeSupport.parent_item(theme, 'moin/moin-2.0/Item') expected = 'moin/moin-2.0' assert test_result == expected, 'Expected "%(expected)s" but got "%(test_result)s"' % locals( )
def theme(self): return ThemeSupport(app.cfg)