def test_load_brain_selector(self): configuration = BotConfiguration() configuration._brain_selector = "programy.bot.DefaultBrainSelector" client = TestClient() bot = Bot(configuration, client) factory = BrainFactory(bot) self.assertIsNotNone(factory) factory.load_brain_selector(configuration) self.assertIsInstance(factory._brain_selector, DefaultBrainSelector)
def test_empty_config_init(self): configuration = BotConfiguration() configuration._bot_selector = "programy.clients.client.DefaultBrainSelector" bot = Bot(configuration) factory = BrainFactory(bot) self.assertIsNotNone(factory) brain = factory.select_brain() self.assertIsNotNone(brain) self.assertIsInstance(brain, Brain)
def test_empty_config_init(self): configuration = BotConfiguration() client = TestClient() bot = Bot(configuration, client) factory = BrainFactory(bot) self.assertIsNotNone(factory) brain = factory.select_brain() self.assertIsNotNone(brain) self.assertIsInstance(brain, Brain)
def test_invalid_config_init(self): configuration = BotConfiguration() configuration._brain_selector = "programy.clients.client.DefaultBrainSelectorXXX" client = TestClient() bot = Bot(configuration, client) factory = BrainFactory(bot) self.assertIsNotNone(factory) brain = factory.select_brain() self.assertIsNotNone(brain) self.assertIsInstance(brain, Brain)