deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mar...@apache.org
Subject [2/4] git commit: API TESTS: adds base tests for all collections - to be expanded
Date Fri, 03 Aug 2012 15:01:41 GMT
API TESTS: adds base tests for all collections - to be expanded


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

Branch: refs/heads/master
Commit: ed3ddb14f70c8ee46793b0132c522dccf8d0301f
Parents: bada80f
Author: marios <marios@redhat.com>
Authored: Fri Aug 3 17:59:52 2012 +0300
Committer: marios <marios@redhat.com>
Committed: Fri Aug 3 18:01:03 2012 +0300

----------------------------------------------------------------------
 tests/deltacloud/base_api_test.rb          |   30 +++++++++++-----------
 tests/deltacloud/hardware_profiles_test.rb |   28 +++++++++++++++++++++
 tests/deltacloud/instance_states_test.rb   |   28 +++++++++++++++++++++
 tests/deltacloud/keys_test.rb              |   28 +++++++++++++++++++++
 tests/deltacloud/realms_test.rb            |   29 ++++++++++++++++++++++
 tests/deltacloud/storage_snapshots_test.rb |   28 +++++++++++++++++++++
 tests/deltacloud/storage_volumes_test.rb   |   28 +++++++++++++++++++++
 7 files changed, 184 insertions(+), 15 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ed3ddb14/tests/deltacloud/base_api_test.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/base_api_test.rb b/tests/deltacloud/base_api_test.rb
index bd37b46..0af6c3d 100644
--- a/tests/deltacloud/base_api_test.rb
+++ b/tests/deltacloud/base_api_test.rb
@@ -31,14 +31,14 @@ describe "Deltacloud API Entry Point" do
   end
 
   it 'advertise the current driver in API entrypoint' do
-    res = get_api :accept => :xml
+    res = get_api
     driver = res.xml.root[:driver]
     driver.wont_be_nil
     api.drivers.include?(driver).must_equal true
   end
 
   it 'advertise the current API version in API entrypoint' do
-    res = get_api :accept => :xml
+    res = get_api
     version = res.xml.root[:version]
     version.wont_be_nil
     version.must_equal api.version
@@ -55,30 +55,30 @@ describe "Deltacloud API Entry Point" do
   end
 
   it 'advertise collections in API entrypoint' do
-    res = get_api :accept => :xml
+    res = get_api
     res.xml.xpath('//api/link').wont_be_empty
   end
 
   it 'include the :href and :rel attribute for each collection in API entrypoint' do
-    get_api(:accept => :xml).xml.xpath("//api/link").each do |collection|
+    get_api().xml.xpath("//api/link").each do |collection|
       collection[:href].wont_be_nil
       collection[:rel].wont_be_nil
     end
   end
 
   it 'uses the absolute URI in the :href attribute for each collection in API entrypoint'
do
-    get_api(:accept => :xml).xml.xpath("//api/link").each do |collection|
+    get_api().xml.xpath("//api/link").each do |collection|
       collection[:href].must_match /^http/
     end
   end
 
   it 'advertise features for some collections in API entrypoint' do
-    doc = get_api(:accept => :xml)
+    doc = get_api()
     doc.xml.xpath("//api/link/feature").wont_be_empty
   end
 
   it 'advertise the name of the feature for some collections in API entrypoint' do
-    get_api(:accept => :xml).xml.xpath("//api/link/feature").each do |feature|
+    get_api().xml.xpath("//api/link/feature").each do |feature|
       feature[:name].wont_be_nil
     end
   end
@@ -94,17 +94,17 @@ describe "Deltacloud API Entry Point" do
   end
 
   it 'must change the driver when using X-Deltacloud-Driver HTTP header' do
-    res = get_api(:driver => 'ec2', :accept=> :xml)
+    res = get_api(:driver => 'ec2')
     res.xml.root[:driver].must_equal 'ec2'
-    res = get_api(:driver => 'mock', :accept=> :xml)
+    res = get_api(:driver => 'mock')
     res.xml.root[:driver].must_equal 'mock'
   end
 
   it 'must change the features when driver is swapped using HTTP headers' do
-    res = get_api(:driver => 'ec2', :accept=> :xml)
+    res = get_api(:driver => 'ec2')
     # The 'user_name' feature is not supported currently for the EC2 driver
     (res.xml/'api/link/feature').map { |f| f[:name] }.wont_include 'user_name'
-    res = get_api(:driver => 'mock', :accept=> :xml)
+    res = get_api(:driver => 'mock')
     # But it's supported in Mock driver
     (res.xml/'api/link/feature').map { |f| f[:name] }.must_include 'user_name'
   end
@@ -120,17 +120,17 @@ describe "Deltacloud API Entry Point" do
   end
 
   it 'must change the API PROVIDER using the /api;provider matrix parameter in URI' do
-    res = get(';provider=test1', :public => true)
+    res = get(";provider=test1", :noauth=>true)
     res.xml.root[:provider].wont_be_nil
     res.xml.root[:provider].must_equal 'test1'
-    res = get(';provider=test2', :public => true)
+    res = get(";provider=test2", :noauth=>true)
     res.xml.root[:provider].must_equal 'test2'
   end
 
   it 'must change the API DRIVER using the /api;driver matrix parameter in URI' do
-    res = get(';driver=ec2', :public => true)
+    res = get(";driver=ec2", :noauth=>true)
     res.xml.root[:driver].must_equal 'ec2'
-    res = get(';driver=mock', :public => true)
+    res = get(";driver=mock", :noauth=>true)
     res.xml.root[:driver].must_equal 'mock'
   end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ed3ddb14/tests/deltacloud/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/hardware_profiles_test.rb b/tests/deltacloud/hardware_profiles_test.rb
index e69de29..dfb23cb 100644
--- a/tests/deltacloud/hardware_profiles_test.rb
+++ b/tests/deltacloud/hardware_profiles_test.rb
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+$:.unshift File.join(File.dirname(__FILE__), '..')
+require "deltacloud/test_setup.rb"
+
+describe 'Deltacloud API hardware_profiles collection' do
+  include Deltacloud::Test::Methods
+
+  need_collection :hardware_profiles
+
+  #Run the 'common' tests for all collections defined in common_tests_collections.rb
+  CommonCollectionsTest::run_collection_and_member_tests_for("hardware_profiles")
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ed3ddb14/tests/deltacloud/instance_states_test.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/instance_states_test.rb b/tests/deltacloud/instance_states_test.rb
index e69de29..fadf3ac 100644
--- a/tests/deltacloud/instance_states_test.rb
+++ b/tests/deltacloud/instance_states_test.rb
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+$:.unshift File.join(File.dirname(__FILE__), '..')
+require "deltacloud/test_setup.rb"
+
+describe 'Deltacloud API instance_states collection' do
+  include Deltacloud::Test::Methods
+
+  need_collection :instance_states
+
+  #Run the 'common' tests for all collections defined in common_tests_collections.rb
+  CommonCollectionsTest::run_collection_tests_for("instance_states")
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ed3ddb14/tests/deltacloud/keys_test.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/keys_test.rb b/tests/deltacloud/keys_test.rb
index e69de29..0c506bc 100644
--- a/tests/deltacloud/keys_test.rb
+++ b/tests/deltacloud/keys_test.rb
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+$:.unshift File.join(File.dirname(__FILE__), '..')
+require "deltacloud/test_setup.rb"
+
+describe 'Deltacloud API keys collection' do
+  include Deltacloud::Test::Methods
+
+  need_collection :keys
+
+  #Run the 'common' tests for all collections defined in common_tests_collections.rb
+  CommonCollectionsTest::run_collection_and_member_tests_for("keys")
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ed3ddb14/tests/deltacloud/realms_test.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/realms_test.rb b/tests/deltacloud/realms_test.rb
index e69de29..18a6450 100644
--- a/tests/deltacloud/realms_test.rb
+++ b/tests/deltacloud/realms_test.rb
@@ -0,0 +1,29 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+$:.unshift File.join(File.dirname(__FILE__), '..')
+require "deltacloud/test_setup.rb"
+
+describe 'Deltacloud API realms collection' do
+  include Deltacloud::Test::Methods
+
+  need_collection :realms
+
+  #Run the 'common' tests for all collections defined in common_tests_collections.rb
+  CommonCollectionsTest::run_collection_and_member_tests_for("realms")
+
+end
+

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ed3ddb14/tests/deltacloud/storage_snapshots_test.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/storage_snapshots_test.rb b/tests/deltacloud/storage_snapshots_test.rb
index e69de29..173b746 100644
--- a/tests/deltacloud/storage_snapshots_test.rb
+++ b/tests/deltacloud/storage_snapshots_test.rb
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+$:.unshift File.join(File.dirname(__FILE__), '..')
+require "deltacloud/test_setup.rb"
+
+describe 'Deltacloud API storage_snapshots collection' do
+  include Deltacloud::Test::Methods
+
+  need_collection :storage_snapshots
+
+  #Run the 'common' tests for all collections defined in common_tests_collections.rb
+  CommonCollectionsTest::run_collection_and_member_tests_for("storage_snapshots")
+
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/ed3ddb14/tests/deltacloud/storage_volumes_test.rb
----------------------------------------------------------------------
diff --git a/tests/deltacloud/storage_volumes_test.rb b/tests/deltacloud/storage_volumes_test.rb
index e69de29..2b79b7d 100644
--- a/tests/deltacloud/storage_volumes_test.rb
+++ b/tests/deltacloud/storage_volumes_test.rb
@@ -0,0 +1,28 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.  The
+# ASF licenses this file to you under the Apache License, Version 2.0 (the
+# "License"); you may not use this file except in compliance with the
+# License.  You may obtain a copy of the License at
+#
+#       http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
+# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.  See the
+# License for the specific language governing permissions and limitations
+# under the License.
+
+$:.unshift File.join(File.dirname(__FILE__), '..')
+require "deltacloud/test_setup.rb"
+
+describe 'Deltacloud API storage_volumes collection' do
+  include Deltacloud::Test::Methods
+
+  need_collection :storage_volumes
+
+  #Run the 'common' tests for all collections defined in common_tests_collections.rb
+  CommonCollectionsTest::run_collection_and_member_tests_for("storage_volumes")
+
+end


Mime
View raw message