Merge "Get on an abandon zone returns 405"

This commit is contained in:
Jenkins 2015-02-18 16:53:04 +00:00 committed by Gerrit Code Review
commit 54726e9e36
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

@ -361,7 +361,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
@ -373,6 +373,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')