class TestIPlugin(unittest.TestCase): def setUp(self): self.plugin = IPlugin() def test_active(self): self.assertFalse(self.plugin.active) def test_key_not_in_config(self): self.plugin.CONFIG_TEMPLATE = {"api_key": None} self.assertRaises(Exception, self.plugin.check_configuration, {}) def test_autoname(self): plugin = IPlugin() self.assertEqual(plugin.name, "IPlugin") def test_activate(self): self.plugin.activate() self.assertTrue(self.plugin.active) def test_deactivate(self): self.plugin.deactivate() self.assertFalse(self.plugin.active) def test_check_configuration(self): self.assertTrue(self.plugin.check_configuration({"shared": None})) def test_configure(self): test_obj = TestObj() self.plugin.configure(test_obj) self.assertEqual(self.plugin.configuration, test_obj) def test_name(self): self.assertEqual(self.plugin.name, "IPlugin")
class TestIPlugin(unittest.TestCase): def setUp(self): self.plugin = IPlugin() def test_active(self): self.assertFalse(self.plugin.active) def test_key_not_in_config(self): self.plugin.CONFIG_TEMPLATE = {'api_key': None} self.assertRaises(Exception, self.plugin.check_configuration, {}) def test_autoname(self): plugin = IPlugin() self.assertEqual(plugin.name, "IPlugin") def test_activate(self): self.plugin.activate() self.assertTrue(self.plugin.active) def test_deactivate(self): self.plugin.deactivate() self.assertFalse(self.plugin.active) def test_check_configuration(self): self.assertTrue(self.plugin.check_configuration({'shared': None})) def test_configure(self): test_obj = TestObj() self.plugin.configure(test_obj) self.assertEqual(self.plugin.configuration, test_obj) def test_name(self): self.assertEqual(self.plugin.name, 'IPlugin')
def setUp(self): self.plugin = IPlugin()
def test_get_plugins(self): plugins = [IPlugin(), 4, IPlugin, Subclass] plugins = self.parser(plugins) self.assertIn(Subclass, plugins) self.assertNotIn(4, plugins)
def test_autoname(self): plugin = IPlugin() self.assertEqual(plugin.name, "IPlugin")
preexec_fn=os.setsid, **kwargs) print('subprocess {} started'.format(self.platform)) await self._reoccuring() async def _reoccuring(self): encoding = locale.getpreferredencoding(False) while True: async for line in self.process.stdout: self._parse_communication(line.decode(encoding)) def _parse_communication(self, comms): try: command, body = comms.split(sep=' ', maxsplit=1) body = body.rstrip() except ValueError: command = comms.rstrip() if command == 'MSG': nick, message = parse('NICK: {} BODY: {}', body) self.chat_signal.emit(nick, message, self.platform) elif command == 'CONNECTED': self.connected_signal.emit(True, self.platform) elif command == 'DISCONNECTED': self.connected_signal.emit(False, self.platform) # NOTE: Forcing `WebsitePlugin` to be subclass of IPlugin # for ease of parsing IPlugin.register(WebsitePlugin)