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 list.")), )
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_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_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_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_accept_from_config(self, *args, **kwargs): ret = telegram_bot_msg.validate([{'token': 'bcd'}]) self.assertEqual(ret, (False, ('Not all required configuration for ' 'telegram_bot_msg are set.')))