You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@deltacloud.apache.org by Matt Wagner <ma...@redhat.com> on 2011/04/08 01:09:16 UTC
[PATCH] All create operations now return 201 status
---
server/server.rb | 21 +++++++++++++++++----
server/tests/drivers/mock/instances_test.rb | 5 +++++
2 files changed, 22 insertions(+), 4 deletions(-)
diff --git a/server/server.rb b/server/server.rb
index 585f3e6..ce960f5 100644
--- a/server/server.rb
+++ b/server/server.rb
@@ -217,7 +217,10 @@ END
:description => params[:description]
})
respond_to do |format|
- format.xml { haml :"images/show" }
+ format.xml do
+ response.status = 201 # Created
+ haml :"images/show"
+ end
format.html { haml :"images/show" }
end
end
@@ -323,7 +326,10 @@ collection :load_balancers do
control do
@load_balancer = driver.create_load_balancer(credentials, params)
respond_to do |format|
- format.xml { haml :"load_balancers/show" }
+ format.xml do
+ response.status = 201 # Created
+ haml :"load_balancers/show"
+ end
format.html { haml :"load_balancers/show" }
end
end
@@ -528,6 +534,7 @@ collection :storage_snapshots do
with_capability :create_storage_snapshot
param :volume_id, :string, :required
control do
+ response.status = 201 # Created
@storage_snapshot = driver.create_storage_snapshot(credentials, params)
show(:storage_snapshot)
end
@@ -588,7 +595,10 @@ collection :storage_volumes do
@storage_volume = driver.create_storage_volume(credentials, params)
respond_to do |format|
format.html { haml :"storage_volumes/show" }
- format.xml { haml :"storage_volumes/show" }
+ format.xml do
+ response.status = 201 # Created
+ haml :"storage_volumes/show"
+ end
end
end
end
@@ -665,7 +675,10 @@ collection :keys do
@key = driver.create_key(credentials, { :key_name => params[:name] })
respond_to do |format|
format.html { haml :"keys/show" }
- format.xml { haml :"keys/show", :ugly => true }
+ format.xml do
+ response.status = 201 # Created
+ haml :"keys/show", :ugly => true
+ end
end
end
end
diff --git a/server/tests/drivers/mock/instances_test.rb b/server/tests/drivers/mock/instances_test.rb
index ca99b6d..e4a3d22 100644
--- a/server/tests/drivers/mock/instances_test.rb
+++ b/server/tests/drivers/mock/instances_test.rb
@@ -184,6 +184,11 @@ module DeltacloudUnitTest
end
end
+ def test_create_key_returns_201
+ post_url '/api/keys', {:name => Time.now.to_f.to_s}
+ last_response.status.should == 201
+ end
+
private
def test_instance_attributes(instance)
--
1.7.4.2