Example #1
0
 def test_update_config_value_does_not_exist(self):
     request = config_message.UpdateConfigRequest(
         name='Does not exist!',
         config_type=config_message.ConfigType.BOOLEAN,
         boolean_value=False)
     self.assertRaisesRegexp(config_api.endpoints.BadRequestException,
                             'No such name', self.service.update_config,
                             request)
Example #2
0
 def test_update_config_list(self):
     mock_config = 'test_config_list'
     mock_config_value = ['email1', 'email2']
     config_defaults.DEFAULTS[mock_config] = mock_config_value
     request = config_message.UpdateConfigRequest(
         name=mock_config,
         config_type=config_message.ConfigType.LIST,
         list_value=mock_config_value)
     response = self.service.update_config(request)
     self.assertIsInstance(response, message_types.VoidMessage)
     setting_value = config_model.Config.get(name=mock_config)
     self.assertEqual(setting_value, mock_config_value)
Example #3
0
 def test_update_config_integer(self):
     mock_config = 'test_config_integer'
     mock_config_value = 5
     config_defaults.DEFAULTS[mock_config] = mock_config_value
     request = config_message.UpdateConfigRequest(
         name=mock_config,
         config_type=config_message.ConfigType.INTEGER,
         integer_value=mock_config_value)
     response = self.service.update_config(request)
     self.assertIsInstance(response, message_types.VoidMessage)
     setting_value = config_model.Config.get(name=mock_config)
     self.assertEqual(setting_value, mock_config_value)
Example #4
0
 def test_update_config_string(self):
     mock_config = 'test_config_string'
     mock_config_value = 'File a ticket!'
     config_defaults.DEFAULTS[mock_config] = mock_config_value
     request = config_message.UpdateConfigRequest(
         name=mock_config,
         config_type=config_message.ConfigType.STRING,
         string_value=mock_config_value)
     response = self.service.update_config(request)
     self.assertIsInstance(response, message_types.VoidMessage)
     setting_value = config_model.Config.get(name=mock_config)
     self.assertEqual(setting_value, mock_config_value)
Example #5
0
 def test_update_config_boolean(self):
     mock_config = 'test_config_bool'
     mock_config_value = False
     config_defaults.DEFAULTS[mock_config] = mock_config_value
     request = config_message.UpdateConfigRequest(
         name=mock_config,
         config_type=config_message.ConfigType.BOOLEAN,
         boolean_value=mock_config_value)
     response = self.service.update_config(request)
     self.assertIsInstance(response, message_types.VoidMessage)
     setting_value = config_model.Config.get(name=mock_config)
     self.assertEqual(setting_value, mock_config_value)
Example #6
0
 def test_update_config_bad_request(self):
     request = config_message.UpdateConfigRequest()
     with self.assertRaises(config_api.endpoints.BadRequestException):
         self.service.update_config(request)