Make the SingleCellSimple fixture a little more comprehensive

This also mocks out CellMapping.get_by_uuid() as well as the hostmapping
to fool the compute api changes (and any others) that come later.

Change-Id: Id94c0ed0913d0ce6d8ff598c670af4da0e58e968
This commit is contained in:
Dan Smith
2016-12-13 15:24:10 -08:00
parent aba18ab045
commit 02c1e6dc45

View File

@@ -268,10 +268,26 @@ class SingleCellSimple(fixtures.Fixture):
self.useFixture(fixtures.MonkeyPatch(
'nova.objects.CellMappingList._get_all_from_db',
self._fake_cell_list))
self.useFixture(fixtures.MonkeyPatch(
'nova.objects.CellMapping._get_by_uuid_from_db',
self._fake_cell_get))
self.useFixture(fixtures.MonkeyPatch(
'nova.objects.HostMapping._get_by_host_from_db',
self._fake_hostmapping_get))
self.useFixture(fixtures.MonkeyPatch(
'nova.context.target_cell',
self._fake_target_cell))
def _fake_hostmapping_get(self, *args):
return {'id': 1,
'updated_at': None,
'created_at': None,
'host': 'host1',
'cell_mapping': self._fake_cell_list()[0]}
def _fake_cell_get(self, *args):
return self._fake_cell_list()[0]
def _fake_cell_list(self, *args):
return [{'id': 1,
'updated_at': None,