def test_get_host_by_ip_address_filter(self, fake_hosts):
region_id = 1
ip_address = '10.10.0.1'
filters = {
'region_id': 1, 'ip_address': ip_address,
'resolved-values': True,
}
path_query = '/v1/hosts?region_id={}&ip_address={}'.format(
region_id, ip_address
)
fake_hosts.return_value = (fake_resources.HOSTS_LIST_R2, {})
resp = self.get(path_query)
host_resp = fake_resources.HOSTS_LIST_R2
self.assertEqual(len(resp.json['hosts']), 1)
self.assertEqual(resp.json['hosts'][0]["name"], host_resp[0].name)
fake_hosts.assert_called_once_with(
mock.ANY, filters, {'limit': 30, 'marker': None},
)
评论列表
文章目录