Get on an abandon zone returns 405

Only a POST is valid on an abandon zone endpoint
(v2/zones/<zone_id>/tasks/abandon). All the other
operations including a get return 405

Change-Id: I0a812ad96b3c0da133dc506d2c4df7557bc3d5fd
Closes-Bug: 1421416
This commit is contained in:
Vinod Mangalpally 2015-02-17 10:42:36 -06:00
parent 86dddab7e3
commit c4666a8cca
2 changed files with 22 additions and 1 deletions

View File

@ -38,3 +38,8 @@ class AbandonController(rest.RestController):
# NOTE: This is a hack and a half.. But Pecan needs it.
return ''
@pecan.expose(template='json:', content_type='application/json')
@utils.validate_uuid('zone_id')
def get_all(self, zone_id, **params):
pecan.abort(405)

View File

@ -354,7 +354,7 @@ class ApiV2ZonesTest(ApiV2TestCase):
self._assert_exception('domain_not_found', 404, self.client.delete,
url)
def test_abandon_zone(self):
def test_post_abandon_zone(self):
zone = self.create_domain()
url = '/zones/%s/tasks/abandon' % zone.id
@ -366,6 +366,22 @@ class ApiV2ZonesTest(ApiV2TestCase):
response = self.client.post_json(url)
self.assertEqual(204, response.status_int)
def test_get_abandon_zone(self):
zone = self.create_domain()
url = '/zones/%s/tasks/abandon' % zone.id
self._assert_exception('method_not_allowed', 405, self.client.get, url)
def test_get_invalid_abandon(self):
# This is an invalid endpoint - should return 404
url = '/zones/tasks/abandon'
self._assert_exception('not_found', 404, self.client.get, url)
def test_get_zone_tasks(self):
# This is an invalid endpoint - should return 404
zone = self.create_domain()
url = '/zones/%s/tasks' % zone.id
self._assert_exception('not_found', 404, self.client.get, url)
# Zone import/export
def test_missing_origin(self):
fixture = self.get_zonefile_fixture(variant='noorigin')