'Tests that if a service is deleted but the compute node is not we
don\'t fail when listing hypervisors.'

def test_show_compute_host_not_mapped(self):

    @mock.patch.object(self.controller.host_api, 'compute_node_get', return_value=self.TEST_HYPERS_OBJ[0])
    @mock.patch.object(self.controller.host_api, 'service_get_by_compute_host')
    def _test(self, mock_service, mock_compute_node_get):
        req = self._get_request(True)
        mock_service.side_effect = exception.HostMappingNotFound(name='foo')
        hyper_id = self._get_hyper_id()
        self.assertRaises(exc.HTTPNotFound, self.controller.show, req, hyper_id)
        self.assertTrue(mock_service.called)
        mock_compute_node_get.assert_called_once_with(mock.ANY, hyper_id)
    _test(self)
