def linkResult(self):
     """
     Возвращает строку, представляющую собой оформленную ссылку
     в нужном представлении (HTML, wiki и т.п.)
     """
     linkCreator = LinkCreator(WikiConfig(self._application.config))
     return linkCreator.create(self.link, self.comment)
Beispiel #2
0
    def testEmptyCommentStrip0(self):
        comment = "  "
        link = "Ссылко бла-бла-бла"

        creator = LinkCreator(self.config)
        text = creator.create(link, comment)

        self.assertEqual(text, "[[Ссылко бла-бла-бла]]")
Beispiel #3
0
    def testLinkComment0(self):
        comment = "Ссылко бла-бла-бла"
        link = comment

        creator = LinkCreator(self.config)
        text = creator.create(link, comment)

        self.assertEqual(text, "[[Ссылко бла-бла-бла]]")
Beispiel #4
0
    def testCreateStyle0(self):
        comment = "Бла-бла-бла"
        link = "Ссылко бла-бла-бла"

        creator = LinkCreator(self.config)
        text = creator.create(link, comment)

        self.assertEqual(text, "[[Бла-бла-бла -> Ссылко бла-бла-бла]]")
Beispiel #5
0
    def testLinkCommentInvalid(self):
        self.config.linkStyleOptions.value = 100
        comment = "Ссылко бла-бла-бла"
        link = comment

        creator = LinkCreator(self.config)
        text = creator.create(link, comment)

        self.assertEqual(text, "[[Ссылко бла-бла-бла]]")
Beispiel #6
0
    def testEmptyComment1(self):
        self.config.linkStyleOptions.value = 1
        comment = ""
        link = "Ссылко бла-бла-бла"

        creator = LinkCreator(self.config)
        text = creator.create(link, comment)

        self.assertEqual(text, "[[Ссылко бла-бла-бла]]")
Beispiel #7
0
    def testCreateStyleInvalid(self):
        self.config.linkStyleOptions.value = 100
        comment = u"Бла-бла-бла"
        link = u"Ссылко бла-бла-бла"

        creator = LinkCreator(self.config)
        text = creator.create(link, comment)

        self.assertEqual(text, u"[[Бла-бла-бла -> Ссылко бла-бла-бла]]")
Beispiel #8
0
    def testLinkCommentStrip1(self):
        self.config.linkStyleOptions.value = 1
        comment = u"   Ссылко бла-бла-бла     "
        link = u"Ссылко бла-бла-бла"

        creator = LinkCreator(self.config)
        text = creator.create(link, comment)

        self.assertEqual(text, u"[[Ссылко бла-бла-бла]]")