'Test listing hypervisors with details and using the
hypervisor_hostname_pattern query string.'

def test_search(self):

    req = self._get_request(use_admin_context=True, url='/os-hypervisors?hypervisor_hostname_pattern=shenzhen')
    with mock.patch.object(self.controller.host_api, 'compute_node_search_by_hypervisor', return_value=objects.ComputeNodeList(objects=[TEST_HYPERS_OBJ[0]])) as s:
        result = self.controller.detail(req)
        s.assert_called_once_with(req.environ['nova.context'], 'shenzhen')
    expected = {'hypervisors': [{'cpu_info': {'arch': 'x86_64', 'features': [], 'model': '', 'topology': {'cores': 1, 'sockets': 1, 'threads': 1}, 'vendor': 'fake'}, 'current_workload': 2, 'disk_available_least': 100, 'free_disk_gb': 125, 'free_ram_mb': 5120, 'host_ip': netaddr.IPAddress('1.1.1.1'), 'hypervisor_hostname': 'hyper1', 'hypervisor_type': 'xen', 'hypervisor_version': 3, 'id': TEST_HYPERS_OBJ[0].uuid, 'local_gb': 250, 'local_gb_used': 125, 'memory_mb': 10240, 'memory_mb_used': 5120, 'running_vms': 2, 'service': {'disabled_reason': None, 'host': 'compute1', 'id': TEST_SERVICES[0].uuid}, 'state': 'up', 'status': 'enabled', 'vcpus': 4, 'vcpus_used': 2}]}
    self.assertNotIn('hypervisors_links', result)
    self.assertDictEqual(expected, result)
