Example #1
0
 def test_config_property_change_object_with_missing_attribute_in_cmd(self):
     with self.assertRaisesRegexp(
             utils.ValidationError,
         ('The following required attributes are missing: '
          'new_value')):
         config_domain.ConfigPropertyChange(
             {'cmd': 'change_property_value'})
Example #2
0
 def test_to_dict(self):
     config_property_change_dict = {
         'cmd': 'change_property_value',
         'new_value': 'new_value'
     }
     config_property_change_object = config_domain.ConfigPropertyChange(
         config_property_change_dict)
     self.assertEqual(config_property_change_object.to_dict(),
                      config_property_change_dict)
Example #3
0
 def test_config_property_change_object_with_extra_attribute_in_cmd(self):
     with self.assertRaisesRegexp(
             utils.ValidationError,
         ('The following extra attributes are present: invalid')):
         config_domain.ConfigPropertyChange({
             'cmd': 'change_property_value',
             'new_value': 'new_value',
             'invalid': 'invalid'
         })
Example #4
0
    def test_config_property_change_object_with_change_property_value(self):
        config_property_change_object = config_domain.ConfigPropertyChange({
            'cmd':
            'change_property_value',
            'new_value':
            'new_value'
        })

        self.assertEqual(config_property_change_object.cmd,
                         'change_property_value')
        self.assertEqual(config_property_change_object.new_value, 'new_value')
Example #5
0
 def test_config_property_change_object_with_invalid_cmd(self):
     with self.assertRaisesRegexp(utils.ValidationError,
                                  'Command invalid is not allowed'):
         config_domain.ConfigPropertyChange({'cmd': 'invalid'})
Example #6
0
 def test_config_property_change_object_with_missing_cmd(self):
     with self.assertRaisesRegexp(utils.ValidationError,
                                  'Missing cmd key in change dict'):
         config_domain.ConfigPropertyChange({'invalid': 'data'})
 def test_config_property_change_object_with_invalid_cmd(self) -> None:
     with self.assertRaisesRegex(# type: ignore[no-untyped-call]
         utils.ValidationError, 'Command invalid is not allowed'):
         config_domain.ConfigPropertyChange({'cmd': 'invalid'})
 def test_config_property_change_object_with_missing_cmd(self) -> None:
     with self.assertRaisesRegex(# type: ignore[no-untyped-call]
         utils.ValidationError, 'Missing cmd key in change dict'):
         config_domain.ConfigPropertyChange({'invalid': 'data'})