Пример #1
0
    def testSelectPage2(self):
        application = ApplicationParams()
        application.wikiroot = self.wikiroot
        panel = FakeTagsPanel()
        TagsPanelController(panel, application)

        self.wikiroot.selectedPage = self.wikiroot["Страница 1"]
        self.assertTrue("тег 1" in panel.marks)

        application.wikiroot = None
        self.assertEqual(panel.marks, [])
Пример #2
0
    def testClear(self):
        application = ApplicationParams()
        application.wikiroot = self.wikiroot

        panel = FakeTagsPanel()
        TagsPanelController(panel, application)

        self.assertTrue(len(panel.tags) > 0)

        application.wikiroot = None

        self.assertTrue(len(panel.tags) == 0)
Пример #3
0
    def testChangeTags(self):
        application = ApplicationParams()
        application.wikiroot = self.wikiroot
        panel = FakeTagsPanel()
        TagsPanelController(panel, application)

        self.wikiroot["Страница 2"].tags = ["бла-бла-бла"]

        self.assertTrue("тег 1" in panel.tags)
        self.assertTrue("тег 2" not in panel.tags)
        self.assertTrue("тег 3" in panel.tags)
        self.assertTrue("тег 4" in panel.tags)
        self.assertTrue("бла-бла-бла" in panel.tags)
Пример #4
0
    def testTagsChange(self):
        application = ApplicationParams()
        application.wikiroot = self.wikiroot
        panel = FakeTagsPanel()
        TagsPanelController(panel, application)

        self.wikiroot.selectedPage = self.wikiroot["Страница 1"]
        self.assertTrue("тег 1" in panel.marks)

        self.wikiroot["Страница 1"].tags = ["тег 1", "тег 2", "тег 666"]
        self.assertTrue("тег 1" in panel.marks)
        self.assertTrue("тег 2" in panel.marks)
        self.assertTrue("тег 666" in panel.marks)
Пример #5
0
    def testPageRemove(self):
        application = ApplicationParams()
        application.wikiroot = self.wikiroot

        panel = FakeTagsPanel()
        TagsPanelController(panel, application)

        self.wikiroot["Страница 2"].remove()

        self.assertTrue("тег 1" in panel.tags)
        self.assertTrue("тег 2" not in panel.tags)
        self.assertTrue("тег 3" not in panel.tags)
        self.assertTrue("тег 4" in panel.tags)
Пример #6
0
    def testPageCreate(self):
        application = ApplicationParams()
        application.wikiroot = self.wikiroot

        panel = FakeTagsPanel()
        TagsPanelController(panel, application)

        TextPageFactory().create(self.wikiroot, "Страница 10", ["тег 10"])

        self.assertTrue("тег 10" in panel.tags)
        self.assertTrue("тег 1" in panel.tags)
        self.assertTrue("тег 2" in panel.tags)
        self.assertTrue("тег 3" in panel.tags)
        self.assertTrue("тег 4" in panel.tags)
Пример #7
0
    def testCreateTagsPanelController(self):
        application = ApplicationParams()
        application.wikiroot = self.wikiroot
        panel = FakeTagsPanel()

        self.assertEqual(panel.tags, [])

        TagsPanelController(panel, application)

        self.assertTrue("тег 1" in panel.tags)
        self.assertTrue("тег 2" in panel.tags)
        self.assertTrue("тег 3" in panel.tags)
        self.assertTrue("тег 4" in panel.tags)

        self.assertEqual(panel.marks, [])