deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From lut...@apache.org
Subject [10/14] git commit: CIMI tests: check creations against what the spec allows
Date Tue, 11 Dec 2012 03:48:25 GMT
CIMI tests: check creations against what the spec allows

The spec allows returning status 201 or 202; Location header must be set


Project: http://git-wip-us.apache.org/repos/asf/deltacloud/repo
Commit: http://git-wip-us.apache.org/repos/asf/deltacloud/commit/dbda0277
Tree: http://git-wip-us.apache.org/repos/asf/deltacloud/tree/dbda0277
Diff: http://git-wip-us.apache.org/repos/asf/deltacloud/diff/dbda0277

Branch: refs/heads/master
Commit: dbda02777bb5d34bd496d74b79c243a118f5c9d4
Parents: d203c8d
Author: David Lutterkort <lutter@redhat.com>
Authored: Tue Dec 4 21:29:49 2012 -0800
Committer: David Lutterkort <lutter@redhat.com>
Committed: Mon Dec 10 17:08:48 2012 -0800

----------------------------------------------------------------------
 tests/cimi/part2_test.rb |    5 +++--
 tests/cimi/part3_test.rb |    5 +++--
 tests/cimi/part4_test.rb |    5 +++--
 tests/helpers/common.rb  |    1 +
 4 files changed, 10 insertions(+), 6 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/dbda0277/tests/cimi/part2_test.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/part2_test.rb b/tests/cimi/part2_test.rb
index cc6041d..a70c6ed 100644
--- a/tests/cimi/part2_test.rb
+++ b/tests/cimi/part2_test.rb
@@ -77,9 +77,10 @@ end
     log.info("machine name: " + machine.name)
   end
 
-  it "should have a response code equal to 201" do
+  it "should produce a valid create response" do
     machine
-    last_response.code.must_equal 201
+    last_response.code.must_be_one_of [201, 202]
+    last_response.headers[:location].must_be_uri
   end
 
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/dbda0277/tests/cimi/part3_test.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/part3_test.rb b/tests/cimi/part3_test.rb
index 9703618..6da7cf8 100644
--- a/tests/cimi/part3_test.rb
+++ b/tests/cimi/part3_test.rb
@@ -110,9 +110,10 @@ class CreateNewMachineFromMachineTemplate < CIMI::Test::Spec
     log.info("machine name: " + machine.name)
   end
 
-  it "should have a response code equal to 201" do
+  it "should produce a valid create response" do
     machine
-    last_response.code.must_equal 201
+    last_response.code.must_be_one_of [201, 202]
+    last_response.headers[:location].must_be_uri
   end
 
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/dbda0277/tests/cimi/part4_test.rb
----------------------------------------------------------------------
diff --git a/tests/cimi/part4_test.rb b/tests/cimi/part4_test.rb
index 72f22af..c6848c2 100644
--- a/tests/cimi/part4_test.rb
+++ b/tests/cimi/part4_test.rb
@@ -93,9 +93,10 @@ class AddVolumeToMachine < CIMI::Test::Spec
     log.info("volume name: " + volume.name)
   end
 
-  it "should have a response code equal to 201 for creating a volume" do
+  it "should produce a valid create response" do
     volume
-    last_response.code.must_equal 201
+    last_response.code.must_be_one_of [201, 202]
+    last_response.headers[:location].must_be_uri
   end
 
   it "should have the correct resourceURI", :only => :json do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/dbda0277/tests/helpers/common.rb
----------------------------------------------------------------------
diff --git a/tests/helpers/common.rb b/tests/helpers/common.rb
index fd627a2..00266e5 100644
--- a/tests/helpers/common.rb
+++ b/tests/helpers/common.rb
@@ -84,3 +84,4 @@ module MiniTest::Assertions
 end
 
 MiniTest::Expectations::infect_an_assertion :assert_uri, :must_be_uri, :unary
+MiniTest::Expectations::infect_an_assertion :assert_includes, :must_be_one_of


Mime
View raw message