Exemple #1
0
    def test_exception_when_api_key_is_invalid(self) -> None:
        bot_test_instance = MentionHandler()

        with self.mock_config_info({'access_token': 'TEST'}):
            with self.mock_http_conversation('invalid_api_key'):
                with self.assertRaises(StubBotHandler.BotQuitException):
                    bot_test_instance.initialize(StubBotHandler())
Exemple #2
0
    def test_get_alert_id(self) -> None:
        bot_test_instance = MentionHandler()
        bot_test_instance.access_token = 'TEST'
        bot_test_instance.account_id = 'TEST'

        with self.mock_http_conversation('get_alert_id'):
            self.assertEqual(bot_test_instance.get_alert_id('TEST'), 'TEST')
Exemple #3
0
    def test_get_mentions(self) -> None:
        bot_test_instance = MentionHandler()
        bot_test_instance.access_token = 'TEST'
        bot_test_instance.account_id = 'TEST'

        with self.mock_http_conversation('get_mentions'):
            bot_response = bot_test_instance.get_mentions('TEST')[0]
            self.assertEqual(bot_response['title'], 'TEST')
            self.assertEqual(bot_response['original_url'], 'TEST')