From 02c1e6dc454b7ec4a8cdacc4bfd06baf20279f8c Mon Sep 17 00:00:00 2001 From: Dan Smith Date: Tue, 13 Dec 2016 15:24:10 -0800 Subject: [PATCH] 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 --- nova/tests/fixtures.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/nova/tests/fixtures.py b/nova/tests/fixtures.py index 89afb04e3..8beacf46d 100644 --- a/nova/tests/fixtures.py +++ b/nova/tests/fixtures.py @@ -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,