def testDisable(self): dirlist = ["../test/plugins/testempty1", "../test/plugins/testempty2"] loader = PluginsLoader(self.application) loader.load(dirlist) self.assertEqual(len(loader.loadedPlugins), 2) loader.disable('TestEmpty1') self.assertEqual(len(loader.disabledPlugins), 1)
class PluginLoadingMixin(BaseOutWikerGUIMixin, metaclass=ABCMeta): @abstractmethod def getPluginDir(self): """ Должен возвращать путь до папки с тестируемым плагином """ pass @abstractmethod def getPluginName(self): """ Должен возвращать имя плагина, по которому его можно найти в PluginsLoader """ pass def setUp(self): self.initApplication() self.wikiroot = self.createWiki() self.__createWiki() dirlist = [self.getPluginDir()] self.loader = PluginsLoader(self.application) self.loader.load(dirlist) def __createWiki(self): # Здесь будет создаваться вики WikiPageFactory().create(self.wikiroot, "Викистраница", []) TextPageFactory().create(self.wikiroot, "Текст", []) HtmlPageFactory().create(self.wikiroot, "HTML", []) SearchPageFactory().create(self.wikiroot, "Search", []) def tearDown(self): self.application.selectedPage = None self.application.wikiroot = None self.loader.clear() self.destroyApplication() self.destroyWiki(self.wikiroot) def testPluginLoad(self): self.assertEqual(len(self.loader), 1) self.assertNotEqual(self.loader[self.getPluginName()], None) def testDestroy_01(self): self.application.wikiroot = None self.loader.clear() def testDestroy_02(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = None self.loader.clear() def testDestroy_03(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Викистраница"] self.loader.clear() def testDestroy_04(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Текст"] self.loader.clear() def testDestroy_05(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["HTML"] self.loader.clear() def testDestroy_06(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Search"] self.loader.clear() def testDestroy_07(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Викистраница"] self.loader.disable(self.getPluginName()) action = self.application.actionController.getAction(SwitchCodeResultAction.stringId) action.run(None) self.loader.clear() def testDestroy_08(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["HTML"] self.loader.disable(self.getPluginName()) action = self.application.actionController.getAction(SwitchCodeResultAction.stringId) action.run(None) self.loader.clear() def testDestroy_09(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Викистраница"] self.loader.clear() action = self.application.actionController.getAction(SwitchCodeResultAction.stringId) action.run(None) def testDestroy_10(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["HTML"] self.loader.clear() action = self.application.actionController.getAction(SwitchCodeResultAction.stringId) action.run(None)
class PluginLoadingMixin(BaseOutWikerGUIMixin, metaclass=ABCMeta): @abstractmethod def getPluginDir(self): """ Должен возвращать путь до папки с тестируемым плагином """ pass @abstractmethod def getPluginName(self): """ Должен возвращать имя плагина, по которому его можно найти в PluginsLoader """ pass def setUp(self): self.initApplication() self.wikiroot = self.createWiki() self.__createWiki() dirlist = [self.getPluginDir()] self.loader = PluginsLoader(self.application) self.loader.load(dirlist) def __createWiki(self): # Здесь будет создаваться вики WikiPageFactory().create(self.wikiroot, "Викистраница", []) TextPageFactory().create(self.wikiroot, "Текст", []) HtmlPageFactory().create(self.wikiroot, "HTML", []) SearchPageFactory().create(self.wikiroot, "Search", []) def tearDown(self): self.application.selectedPage = None self.application.wikiroot = None self.loader.clear() self.destroyApplication() self.destroyWiki(self.wikiroot) def testPluginLoad(self): self.assertEqual(len(self.loader), 1) self.assertNotEqual(self.loader[self.getPluginName()], None) def testDestroy_01(self): self.application.wikiroot = None self.loader.clear() def testDestroy_02(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = None self.loader.clear() def testDestroy_03(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Викистраница"] self.loader.clear() def testDestroy_04(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Текст"] self.loader.clear() def testDestroy_05(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["HTML"] self.loader.clear() def testDestroy_06(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Search"] self.loader.clear() def testDestroy_07(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Викистраница"] self.loader.disable(self.getPluginName()) action = self.application.actionController.getAction( SwitchCodeResultAction.stringId) action.run(None) self.loader.clear() def testDestroy_08(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["HTML"] self.loader.disable(self.getPluginName()) action = self.application.actionController.getAction( SwitchCodeResultAction.stringId) action.run(None) self.loader.clear() def testDestroy_09(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["Викистраница"] self.loader.clear() action = self.application.actionController.getAction( SwitchCodeResultAction.stringId) action.run(None) def testDestroy_10(self): self.application.wikiroot = self.wikiroot self.application.selectedPage = self.wikiroot["HTML"] self.loader.clear() action = self.application.actionController.getAction( SwitchCodeResultAction.stringId) action.run(None)