def test_create(self, mock_action_start): mock_action_start.return_value = fake_action action = instance_action.InstanceAction(self.context) expected_updates = action.obj_get_changes() action.create() mock_action_start.assert_called_once_with(self.context, expected_updates) self.compare_obj(action, fake_action)
def test_create_id_in_updates_error(self): action = instance_action.InstanceAction(self.context, id=1) ex = self.assertRaises(exception.ObjectActionError, action.create) self.assertIn('already created', six.text_type(ex))