From cc1cc99f49b63826ee97020c9475f65d1b0d4bfc Mon Sep 17 00:00:00 2001 From: Kiall Mac Innes Date: Mon, 22 Jun 2015 14:45:55 +0100 Subject: [PATCH] Fix incorrect status code on Pool update Change the pool update status code from a 200, the correct 202 Accepted. Change-Id: I3de2b55c6fe52c6d65738f2699ffb2ae29212c29 Closes-Bug: 1464763 --- designate/api/v2/controllers/pools.py | 2 +- designate/tests/test_api/test_v2/test_pools.py | 12 ++++++------ functionaltests/api/v2/test_pool.py | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/designate/api/v2/controllers/pools.py b/designate/api/v2/controllers/pools.py index f7a0d1f1..37e6649c 100644 --- a/designate/api/v2/controllers/pools.py +++ b/designate/api/v2/controllers/pools.py @@ -103,7 +103,7 @@ class PoolsController(rest.RestController): pool = self.central_api.update_pool(context, pool) - response.status_int = 200 + response.status_int = 202 return DesignateAdapter.render('API_v2', pool, request=request) diff --git a/designate/tests/test_api/test_v2/test_pools.py b/designate/tests/test_api/test_v2/test_pools.py index bcc10cbd..ac8f2b99 100644 --- a/designate/tests/test_api/test_v2/test_pools.py +++ b/designate/tests/test_api/test_v2/test_pools.py @@ -176,10 +176,10 @@ class ApiV2PoolsTest(ApiV2TestCase): body = {'description': 'Tester'} url = '/pools/%s' % pool['id'] - response = self.client.patch_json(url, body, status=200) + response = self.client.patch_json(url, body, status=202) # Check the headers are what we expect - self.assertEqual(200, response.status_int) + self.assertEqual(202, response.status_int) self.assertEqual('application/json', response.content_type) # Check the body structure is what we expect @@ -217,10 +217,10 @@ class ApiV2PoolsTest(ApiV2TestCase): ]} url = '/pools/%s' % pool['id'] - response = self.client.patch_json(url, body, status=200) + response = self.client.patch_json(url, body, status=202) # Check the headers are what we expect - self.assertEqual(200, response.status_int) + self.assertEqual(202, response.status_int) self.assertEqual('application/json', response.content_type) # Check the body structure is what we expect @@ -241,10 +241,10 @@ class ApiV2PoolsTest(ApiV2TestCase): body = {"attributes": {"scope": "private"}} url = '/pools/%s' % pool['id'] - response = self.client.patch_json(url, body, status=200) + response = self.client.patch_json(url, body, status=202) # Check the headers are what we expect - self.assertEqual(200, response.status_int) + self.assertEqual(202, response.status_int) self.assertEqual('application/json', response.content_type) # Check the values returned are what we expect diff --git a/functionaltests/api/v2/test_pool.py b/functionaltests/api/v2/test_pool.py index bf5ffd78..6fa38b80 100644 --- a/functionaltests/api/v2/test_pool.py +++ b/functionaltests/api/v2/test_pool.py @@ -45,7 +45,7 @@ class PoolTest(DesignateV2Test): patch_model = datagen.random_pool_data() resp, new_model = PoolClient.as_user('admin').patch_pool( old_model.id, patch_model) - self.assertEqual(resp.status, 200) + self.assertEqual(resp.status, 202) resp, model = PoolClient.as_user('admin').get_pool(new_model.id) self.assertEqual(resp.status, 200)