def setUp(self):
     super(CellsManagerClassTestCase, self).setUp()
     fakes.init(self)
     # pick a child cell to use for tests.
     self.our_cell = 'grandchild-cell1'
     self.cells_manager = fakes.get_cells_manager(self.our_cell)
     self.msg_runner = self.cells_manager.msg_runner
     self.state_manager = fakes.get_state_manager(self.our_cell)
     self.driver = self.cells_manager.driver
     self.ctxt = 'fake_context'
    def test_post_start_hook_middle_cell(self):
        cells_manager = fakes.get_cells_manager('child-cell2')
        msg_runner = cells_manager.msg_runner
        driver = cells_manager.driver

        self.mox.StubOutWithMock(driver, 'start_servers')
        self.mox.StubOutWithMock(context, 'get_admin_context')
        self.mox.StubOutWithMock(msg_runner,
                                 'ask_children_for_capabilities')
        self.mox.StubOutWithMock(msg_runner,
                                 'ask_children_for_capacities')

        driver.start_servers(msg_runner)
        context.get_admin_context().AndReturn(self.ctxt)
        msg_runner.ask_children_for_capabilities(self.ctxt)
        msg_runner.ask_children_for_capacities(self.ctxt)
        self.mox.ReplayAll()
        cells_manager.post_start_hook()