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, [])
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)
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)
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)
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)
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)
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, [])