Exemplo n.º 1
0
    def testAttachmentSize4 (self):
        WikiPageFactory.create (self.rootwiki, u"Страница 1", [])
        WikiPageFactory.create (self.rootwiki[u"Страница 1"], u"Страница 2", [])
        WikiPageFactory.create (self.rootwiki[u"Страница 1/Страница 2"], u"Страница 3", [])
        WikiPageFactory.create (self.rootwiki, u"Страница 4", [])
        SearchPageFactory.create (self.rootwiki, u"Страница 5", [])

        Attachment (self.rootwiki[u"Страница 1"]).attach ([])
        Attachment (self.rootwiki[u"Страница 1/Страница 2"]).attach (self.fullFilesPath[0:1])
        Attachment (self.rootwiki[u"Страница 1/Страница 2/Страница 3"]).attach (self.fullFilesPath[0:2])
        Attachment (self.rootwiki[u"Страница 4"]).attach (self.fullFilesPath[0:3])
        Attachment (self.rootwiki[u"Страница 5"]).attach (self.fullFilesPath)

        treeStat = self.loader[self.__pluginname].getTreeStat (self.rootwiki)

        pagesList = treeStat.pageAttachmentsSize

        self.assertEqual (len (pagesList), 5)

        self.assertEqual (pagesList[4][0], self.rootwiki[u"Страница 1"])
        self.assertEqual (pagesList[4][1], 0)

        self.assertEqual (pagesList[0][0], self.rootwiki[u"Страница 5"])
        self.assertAlmostEqual (pagesList[0][1], 11771, delta=300)

        self.assertEqual (pagesList[1][0], self.rootwiki[u"Страница 4"])
        self.assertEqual (pagesList[1][1], 2037)
Exemplo n.º 2
0
    def testAttachmentsSizeSearch1 (self):
        SearchPageFactory.create (self.rootwiki, u"Страница 1", [])
        testPage = self.rootwiki[u"Страница 1"]
        Attachment (testPage).attach (self.fullFilesPath)

        pageStat = self.loader[self.__pluginname].getPageStat (testPage)

        self.assertAlmostEqual (pageStat.attachmentsSize, 11771, delta=300)
Exemplo n.º 3
0
    def setUp (self):
        BaseMainWndTest.setUp (self)

        self.path = u"../test/testwiki"
        removeWiki (self.path)

        self.wikiroot = WikiDocument.create (self.path)

        TextPageFactory.create (self.wikiroot, u"Текстовая страница", [])
        TextPageFactory.create (self.wikiroot, u"Текстовая страница 2", [])

        HtmlPageFactory.create (self.wikiroot, u"HTML-страница", [])
        HtmlPageFactory.create (self.wikiroot, u"HTML-страница 2", [])

        WikiPageFactory.create (self.wikiroot, u"Викистраница", [])
        WikiPageFactory.create (self.wikiroot, u"Викистраница 2", [])

        SearchPageFactory.create (self.wikiroot, u"Поисковая страница", [])
        SearchPageFactory.create (self.wikiroot, u"Поисковая страница 2", [])
Exemplo n.º 4
0
    def testPageContentLength4 (self):
        WikiPageFactory.create (self.rootwiki, u"Страница 1", [])
        WikiPageFactory.create (self.rootwiki[u"Страница 1"], u"Страница 2", [])
        WikiPageFactory.create (self.rootwiki[u"Страница 1/Страница 2"], u"Страница 3", [])
        WikiPageFactory.create (self.rootwiki, u"Страница 4", [])
        SearchPageFactory.create (self.rootwiki, u"Страница 5", [])

        self.rootwiki[u"Страница 1"].content = u"Бла"
        self.rootwiki[u"Страница 1/Страница 2"].content = u"   Бла-бла-бла   "
        self.rootwiki[u"Страница 1/Страница 2/Страница 3"].content = u"Бла-"
        self.rootwiki[u"Страница 4"].content = u" Бла-бла                                  "

        treeStat = self.loader[self.__pluginname].getTreeStat (self.rootwiki)

        pagesList = treeStat.pageContentLength

        self.assertEqual (len (pagesList), 5)

        self.assertEqual (pagesList[4][0], self.rootwiki[u"Страница 5"])
        self.assertEqual (pagesList[4][1], 0)
Exemplo n.º 5
0
    def testTypeCreation (self):
        textPage = TextPageFactory.create (self.rootwiki, u"Текстовая страница", [])
        self.assertEqual (TextWikiPage, type(textPage))

        wikiPage = WikiPageFactory.create (self.rootwiki, u"Вики-страница", [])
        self.assertEqual (WikiWikiPage, type(wikiPage))

        htmlPage = HtmlPageFactory.create (self.rootwiki, u"HTML-страница", [])
        self.assertEqual (HtmlWikiPage, type(htmlPage))

        searchPage = SearchPageFactory.create (self.rootwiki, u"Поисковая страница", [])
        self.assertEqual (SearchWikiPage, type(searchPage))
Exemplo n.º 6
0
        def runTest ():
            SearchPageFactory.create (self.rootwiki, u"Страница 1", [])
            testPage = self.rootwiki[u"Страница 1"]

            pageStat = self.loader[self.__pluginname].getPageStat (testPage)
            pageStat.symbols