Ejemplo n.º 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'})
Ejemplo n.º 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)
Ejemplo n.º 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'
         })
Ejemplo n.º 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')
Ejemplo n.º 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'})
Ejemplo n.º 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'})
Ejemplo n.º 7
0
 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'})
Ejemplo n.º 8
0
 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'})