Merge "Fix response code for successful image upload."

This commit is contained in:
Jenkins
2013-03-01 00:00:01 +00:00
committed by Gerrit Code Review
4 changed files with 7 additions and 7 deletions

View File

@@ -127,7 +127,7 @@ class ResponseSerializer(wsgi.JSONResponseSerializer):
response.headers['Content-Length'] = str(image.size)
def upload(self, response, result):
response.status_int = 201
response.status_int = 204
def create_resource():

View File

@@ -147,7 +147,7 @@ class BaseCacheMiddlewareTest(object):
response, content = http.request(path, 'PUT',
headers=headers,
body=image_data)
self.assertEqual(response.status, 201)
self.assertEqual(response.status, 204)
# Verify image not in cache
image_cached_path = os.path.join(self.api_server.image_cache_dir,

View File

@@ -173,7 +173,7 @@ class TestImages(functional.FunctionalTest):
path = self._url('/v2/images/%s/file' % image_id)
headers = self._headers({'Content-Type': 'application/octet-stream'})
response = requests.put(path, headers=headers, data='ZZZZZ')
self.assertEqual(201, response.status_code)
self.assertEqual(204, response.status_code)
# Checksum should be populated automatically
path = self._url('/v2/images/%s' % image_id)
@@ -255,7 +255,7 @@ class TestImages(functional.FunctionalTest):
path = self._url('/v2/images/%s/file' % image_id)
headers = self._headers({'Content-Type': 'application/octet-stream'})
response = requests.put(path, headers=headers, data='ZZZZZ')
self.assertEqual(201, response.status_code)
self.assertEqual(204, response.status_code)
# TENANT1 should see the image in their list
path = self._url('/v2/images')
@@ -671,7 +671,7 @@ class TestImageDirectURLVisibility(functional.FunctionalTest):
path = self._url('/v2/images/%s/file' % image_id)
headers = self._headers({'Content-Type': 'application/octet-stream'})
response = requests.put(path, headers=headers, data='ZZZZZ')
self.assertEqual(201, response.status_code)
self.assertEqual(204, response.status_code)
# Image direct_url should be visible
path = self._url('/v2/images/%s' % image_id)
@@ -718,7 +718,7 @@ class TestImageDirectURLVisibility(functional.FunctionalTest):
path = self._url('/v2/images/%s/file' % image_id)
headers = self._headers({'Content-Type': 'application/octet-stream'})
response = requests.put(path, headers=headers, data='ZZZZZ')
self.assertEqual(201, response.status_code)
self.assertEqual(204, response.status_code)
# Image direct_url should not be visible
path = self._url('/v2/images/%s' % image_id)

View File

@@ -317,5 +317,5 @@ class TestImageDataSerializer(test_utils.BaseTestCase):
response = webob.Response()
response.request = request
self.serializer.upload(response, {})
self.assertEqual(201, response.status_int)
self.assertEqual(204, response.status_int)
self.assertEqual('0', response.headers['Content-Length'])