diff options
author | Michal Pryc <mpryc@redhat.com> | 2015-12-16 15:12:13 +0100 |
---|---|---|
committer | Michal Pryc <mpryc@redhat.com> | 2015-12-16 17:31:03 +0100 |
commit | 1c67948f137c632d4b34461c7ab11c1ef6d79ab9 (patch) | |
tree | ea0904f89f66d7546b2f8a013504624e5ece12c1 /nova/tests/unit/objects/test_instance_fault.py | |
parent | a1143e184d99a5db8bf055b0e560b79525ba382c (diff) | |
download | nova-1c67948f137c632d4b34461c7ab11c1ef6d79ab9.tar.gz |
Implements proper UUID format for few objects tests.
Currently some of the unittests are using non valid UUID format
for the FieldType UUID.
This is preparation work to add UUID validation in the
oslo_versionedobjects/fields.py.
Without this change adding validation will cause tests to fail.
Change-Id: I6c32f33f4062c1caadffcfd9905113e9f99f5579
Diffstat (limited to 'nova/tests/unit/objects/test_instance_fault.py')
-rw-r--r-- | nova/tests/unit/objects/test_instance_fault.py | 27 |
1 files changed, 15 insertions, 12 deletions
diff --git a/nova/tests/unit/objects/test_instance_fault.py b/nova/tests/unit/objects/test_instance_fault.py index 9e43346acd..8c700c2ad9 100644 --- a/nova/tests/unit/objects/test_instance_fault.py +++ b/nova/tests/unit/objects/test_instance_fault.py @@ -18,16 +18,19 @@ from nova import db from nova import exception from nova.objects import instance_fault from nova.tests.unit.objects import test_objects +from nova.tests import uuidsentinel as uuids fake_faults = { 'fake-uuid': [ - {'id': 1, 'instance_uuid': 'fake-uuid', 'code': 123, 'message': 'msg1', - 'details': 'details', 'host': 'host', 'deleted': False, - 'created_at': None, 'updated_at': None, 'deleted_at': None}, - {'id': 2, 'instance_uuid': 'fake-uuid', 'code': 456, 'message': 'msg2', - 'details': 'details', 'host': 'host', 'deleted': False, - 'created_at': None, 'updated_at': None, 'deleted_at': None}, + {'id': 1, 'instance_uuid': uuids.faults_instance, 'code': 123, + 'message': 'msg1', 'details': 'details', 'host': 'host', + 'deleted': False, 'created_at': None, 'updated_at': None, + 'deleted_at': None}, + {'id': 2, 'instance_uuid': uuids.faults_instance, 'code': 456, + 'message': 'msg2', 'details': 'details', 'host': 'host', + 'deleted': False, 'created_at': None, 'updated_at': None, + 'deleted_at': None}, ] } @@ -78,7 +81,7 @@ class _TestInstanceFault(object): def _test_create(self, update_cells, mock_create, cells_fault_create): mock_create.return_value = fake_faults['fake-uuid'][1] fault = instance_fault.InstanceFault(context=self.context) - fault.instance_uuid = 'fake-uuid' + fault.instance_uuid = uuids.faults_instance fault.code = 456 fault.message = 'foo' fault.details = 'you screwed up' @@ -86,11 +89,11 @@ class _TestInstanceFault(object): fault.create() self.assertEqual(2, fault.id) mock_create.assert_called_once_with(self.context, - {'instance_uuid': 'fake-uuid', - 'code': 456, - 'message': 'foo', - 'details': 'you screwed up', - 'host': 'myhost'}) + {'instance_uuid': uuids.faults_instance, + 'code': 456, + 'message': 'foo', + 'details': 'you screwed up', + 'host': 'myhost'}) if update_cells: cells_fault_create.assert_called_once_with( self.context, fake_faults['fake-uuid'][1]) |