Merge "Fix v2.1 list-host to remove 'services' filter"
This commit is contained in:
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"hosts": [
|
||||
{
|
||||
"host_name": "09c025b0efc64211bd23fc50fa974cdf",
|
||||
"service": "compute",
|
||||
"zone": "nova"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -84,9 +84,6 @@ class HostController(wsgi.Controller):
|
||||
zone = req.GET.get('zone', None)
|
||||
if zone:
|
||||
filters['availability_zone'] = zone
|
||||
service = req.GET.get('service')
|
||||
if service:
|
||||
filters['topic'] = service
|
||||
services = self.api.service_get_all(context, filters=filters,
|
||||
set_zones=True)
|
||||
hosts = []
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
{
|
||||
"hosts": [
|
||||
{
|
||||
"host_name": "%(host_name)s",
|
||||
"service": "compute",
|
||||
"zone": "nova"
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -50,9 +50,3 @@ class HostsSampleJsonTest(api_sample_base.ApiSampleTestBaseV3):
|
||||
response = self._do_get('os-hosts')
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('hosts-list-resp', subs, response, 200)
|
||||
|
||||
def test_hosts_list_compute_service(self):
|
||||
response = self._do_get('os-hosts?service=compute')
|
||||
subs = self._get_regexes()
|
||||
self._verify_response('hosts-list-compute-service-resp',
|
||||
subs, response, 200)
|
||||
|
||||
@@ -131,16 +131,6 @@ class FakeRequestWithNovaZone(object):
|
||||
GET = {"zone": "nova"}
|
||||
|
||||
|
||||
class FakeRequestWithNovaService(object):
|
||||
environ = {"nova.context": context_maker.get_admin_context()}
|
||||
GET = {"service": "compute"}
|
||||
|
||||
|
||||
class FakeRequestWithInvalidNovaService(object):
|
||||
environ = {"nova.context": context_maker.get_admin_context()}
|
||||
GET = {"service": "invalid"}
|
||||
|
||||
|
||||
class HostTestCaseV21(test.TestCase):
|
||||
"""Test Case for hosts."""
|
||||
validation_ex = exception.ValidationError
|
||||
@@ -392,27 +382,12 @@ class HostTestCaseV21(test.TestCase):
|
||||
hosts = result['hosts']
|
||||
self.assertEqual(fake_hosts.HOST_LIST_NOVA_ZONE, hosts)
|
||||
|
||||
def test_list_hosts_with_service(self):
|
||||
result = self.controller.index(FakeRequestWithNovaService())
|
||||
self.assertEqual(fake_hosts.HOST_LIST_NOVA_ZONE, result['hosts'])
|
||||
|
||||
def test_list_hosts_with_invalid_service(self):
|
||||
result = self.controller.index(FakeRequestWithInvalidNovaService())
|
||||
self.assertEqual([], result['hosts'])
|
||||
|
||||
|
||||
class HostTestCaseV20(HostTestCaseV21):
|
||||
validation_ex = webob.exc.HTTPBadRequest
|
||||
policy_ex = webob.exc.HTTPForbidden
|
||||
Controller = os_hosts_v2.HostController
|
||||
|
||||
# Note: V2 api don't support list with services
|
||||
def test_list_hosts_with_service(self):
|
||||
pass
|
||||
|
||||
def test_list_hosts_with_invalid_service(self):
|
||||
pass
|
||||
|
||||
def test_list_hosts_with_non_admin(self):
|
||||
self.assertRaises(exception.AdminRequired,
|
||||
self.controller.index, fakes.HTTPRequest.blank(''))
|
||||
|
||||
Reference in New Issue
Block a user