def test_validate_config_not_list_in_accept_from(self, *args, **kwargs): ret = telegram_bot_msg.__validate__({ 'token': 'bcd', 'accept_from': { 'nodict': "1" } }) self.assertEqual(ret, (False, ('Configuration for telegram_bot_msg, ' 'accept_from must be a list of ' 'usernames.')))
def test_validate_valid_config(self, *args, **kwargs): ret = telegram_bot_msg.__validate__({ 'token': 'bcd', 'accept_from': ['username'] }) self.assertEqual(ret, (True, 'Valid beacon configuration.'))
def test_validate_missing_token_config(self, *args, **kwargs): ret = telegram_bot_msg.__validate__({'accept_from': []}) self.assertEqual(ret, (False, ('Not all required configuration for ' 'telegram_bot_msg are set.')))
def test_validate_empty_config(self, *args, **kwargs): ret = telegram_bot_msg.__validate__(None) self.assertEqual(ret, (False, ('Configuration for telegram_bot_msg ' 'beacon must be a dictionary.')))