Fixes Output for zone type filter
Closes-Bug: #1506742 Change-Id: Ifd6269fef1061da3fdc5ececd103a79789b9473f
This commit is contained in:
parent
027e3108e1
commit
94f18defa0
designate
@ -62,7 +62,8 @@ class ZonesController(rest.RestController):
|
||||
params, self.SORT_KEYS)
|
||||
|
||||
# Extract any filter params.
|
||||
accepted_filters = ('name', 'email', 'status', 'description', 'ttl', )
|
||||
accepted_filters = ('name', 'type', 'email', 'status',
|
||||
'description', 'ttl', )
|
||||
|
||||
criterion = self._apply_filter_params(
|
||||
params, accepted_filters, {})
|
||||
|
@ -685,6 +685,9 @@ class ApiV2ZonesTest(ApiV2TestCase):
|
||||
response = self.client.post_json('/zones/', fixture)
|
||||
|
||||
get_urls = [
|
||||
# Filter by Type
|
||||
'/zones?type=%s' % fixtures[0]['type'],
|
||||
|
||||
# Filter by Name
|
||||
'/zones?name=%s' % fixtures[0]['name'],
|
||||
|
||||
@ -700,7 +703,7 @@ class ApiV2ZonesTest(ApiV2TestCase):
|
||||
'/zones?description=test*'
|
||||
]
|
||||
|
||||
correct_results = [1, 2, 1, 1, 1, 2]
|
||||
correct_results = [2, 1, 2, 1, 1, 1, 2]
|
||||
|
||||
for get_url, correct_result in zip(get_urls, correct_results):
|
||||
|
||||
@ -714,6 +717,6 @@ class ApiV2ZonesTest(ApiV2TestCase):
|
||||
self.assertEqual(correct_result, len(response.json['zones']))
|
||||
|
||||
def test_invalid_zones_filter(self):
|
||||
invalid_url = '/zones?type=PRIMARY'
|
||||
invalid_url = '/zones?id=155477ef-e6c5-4b94-984d-8fc68c0c1a14'
|
||||
self._assert_exception(
|
||||
'bad_request', 400, self.client.get, invalid_url)
|
||||
|
Loading…
x
Reference in New Issue
Block a user