def test_bot_init_with_config(self): bot_config = BotConfiguration() bot_config._bot_root = BotConfiguration.DEFAULT_ROOT bot_config._default_response = BotConfiguration.DEFAULT_RESPONSE bot_config._exit_response = BotConfiguration.DEFAULT_EXIT_RESPONSE bot_config._initial_question = BotConfiguration.DEFAULT_INITIAL_QUESTION bot_config._empty_string = BotConfiguration.DEFAULT_EMPTY_STRING bot_config._override_properties = BotConfiguration.DEFAULT_OVERRIDE_PREDICATES bot_config._max_question_recursion = 1000 bot_config._max_question_timeout = 60 bot_config._max_search_depth = 100 bot_config._max_search_timeout = 60 client = TestClient() bot = Bot(bot_config, client) self.assertIsNotNone(bot.brain) self.assertIsNone(bot.spell_checker) self.assertIsNotNone(bot.sentence_splitter) self.assertIsNotNone(bot.sentence_joiner) self.assertIsNotNone(bot.conversations) self.assertIsNotNone(bot.default_response) self.assertIsNotNone(bot.exit_response) self.assertIsNotNone(bot.initial_question) self.assertTrue(bot.override_properties) self.assertIsNotNone(bot.get_version_string)
def test_get_exit_response_no_srai(self): bot_config = BotConfiguration() bot_config._exit_response = "Test This" bot_config._exit_response_srai = None self.assertIsNotNone(bot_config) client = TestClient() bot = Bot(bot_config, client) self.assertIsNotNone(bot) self.assertEqual("Test This", bot.get_exit_response(self._client_context))
def test_bot_init_with_config(self): bot_config = BotConfiguration() bot_config._bot_root = BotConfiguration.DEFAULT_ROOT bot_config._default_response = BotConfiguration.DEFAULT_RESPONSE bot_config._exit_response = BotConfiguration.DEFAULT_EXIT_RESPONSE bot_config._initial_question = BotConfiguration.DEFAULT_INITIAL_QUESTION bot_config._empty_string = BotConfiguration.DEFAULT_EMPTY_STRING bot_config._override_properties = BotConfiguration.DEFAULT_OVERRIDE_PREDICATES bot_config._max_question_recursion = 1000 bot_config._max_question_timeout = 60 bot_config._max_search_depth = 100 bot_config._max_search_timeout = 60 bot = Bot(bot_config) self.assertIsNone(bot.spell_checker) self.assertIsNotNone(bot.brain) self.assertIsNotNone(bot.conversations) self.assertIsNotNone(bot.default_response) self.assertIsNotNone(bot.exit_response) self.assertIsNotNone(bot.initial_question) self.assertTrue(bot.override_properties) self.assertIsNotNone(bot.get_version_string)