Exemplo n.º 1
0
 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.')))
Exemplo n.º 2
0
 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.'))
Exemplo n.º 3
0
 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.')))
Exemplo n.º 4
0
 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.')))