Skip to content

Commit

Permalink
PUTing and POSTing using image key
Browse files Browse the repository at this point in the history
  • Loading branch information
rconradharris committed Oct 17, 2010
1 parent 86ed432 commit 9382efb
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions glance/parallax/controllers.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ def create(self, req):
in the 'id' field
"""
image_data = json.loads(req.body)
image_data = json.loads(req.body)['image']

# Ensure the image has a status set
image_data.setdefault('status', 'available')
Expand All @@ -116,7 +116,7 @@ def update(self, req, id):
:retval Returns the updated image information as a mapping,
"""
image_data = json.loads(req.body)
image_data = json.loads(req.body)['image']

context = None
updated_image = db.image_update(context, id, image_data)
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/test_parallax_api.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def test_create_image(self):
req = webob.Request.blank('/images')

req.method = 'POST'
req.body = json.dumps(fixture)
req.body = json.dumps(dict(image=fixture))

res = req.get_response(controllers.API())

Expand Down Expand Up @@ -134,7 +134,7 @@ def test_create_image_with_bad_status(self):
req = webob.Request.blank('/images')

req.method = 'POST'
req.body = json.dumps(fixture)
req.body = json.dumps(dict(image=fixture))

# TODO(jaypipes): Port Nova's Fault infrastructure
# over to Glance to support exception catching into
Expand All @@ -150,7 +150,7 @@ def test_update_image(self):
req = webob.Request.blank('/images/2')

req.method = 'PUT'
req.body = json.dumps(fixture)
req.body = json.dumps(dict(image=fixture))

res = req.get_response(controllers.API())

Expand All @@ -174,7 +174,7 @@ def test_update_image_not_existing(self):
req = webob.Request.blank('/images/3')

req.method = 'PUT'
req.body = json.dumps(fixture)
req.body = json.dumps(dict(image=fixture))

# TODO(jaypipes): Port Nova's Fault infrastructure
# over to Glance to support exception catching into
Expand Down

0 comments on commit 9382efb

Please sign in to comment.