Fixes Output for zone type filter

Closes-Bug: #1506742

Change-Id: Ifd6269fef1061da3fdc5ececd103a79789b9473f
This commit is contained in:
sonu.kumar 2015-10-21 09:49:26 +05:30 committed by Kiall Mac Innes
parent d7756d66e8
commit bb5c832a24
2 changed files with 7 additions and 3 deletions

View File

@ -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, {})

View File

@ -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)