Browse Source

Fixes Output for zone type filter

Closes-Bug: #1506742

Change-Id: Ifd6269fef1061da3fdc5ececd103a79789b9473f
tags/1.0.1
sonu.kumar Kiall Mac Innes 4 years ago
parent
commit
bb5c832a24
2 changed files with 7 additions and 3 deletions
  1. +2
    -1
      designate/api/v2/controllers/zones/__init__.py
  2. +5
    -2
      designate/tests/test_api/test_v2/test_zones.py

+ 2
- 1
designate/api/v2/controllers/zones/__init__.py 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, {})


+ 5
- 2
designate/tests/test_api/test_v2/test_zones.py 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)

Loading…
Cancel
Save