deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [10/50] [abbrv] git commit: RHEVM: Make possible to run RHEV-M tests using Sinatra::Base
Date Tue, 22 May 2012 20:19:37 GMT
RHEVM: Make possible to run RHEV-M tests using Sinatra::Base


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

Branch: refs/heads/master
Commit: f40fb7819b687916dff5691393aea40b9e764075
Parents: 8edf307
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu May 17 15:45:51 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue May 22 22:17:39 2012 +0200

----------------------------------------------------------------------
 server/tests/drivers/rhevm/api_test.rb             |   18 ++++++++++----
 server/tests/drivers/rhevm/common.rb               |   11 +++++++++
 .../tests/drivers/rhevm/hardware_profiles_test.rb  |    8 +++++-
 server/tests/drivers/rhevm/images_test.rb          |   10 +++++++-
 server/tests/drivers/rhevm/instances_test.rb       |    8 +++++-
 server/tests/drivers/rhevm/realms_test.rb          |    9 +++++-
 server/tests/drivers/rhevm/setup.rb                |   14 -----------
 7 files changed, 54 insertions(+), 24 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f40fb781/server/tests/drivers/rhevm/api_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/api_test.rb b/server/tests/drivers/rhevm/api_test.rb
index eea249e..0d8d69e 100644
--- a/server/tests/drivers/rhevm/api_test.rb
+++ b/server/tests/drivers/rhevm/api_test.rb
@@ -7,11 +7,18 @@ module RHEVMTest
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        use Rack::MatrixParams
+        use Rack::DriverSelect
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_it_returns_entry_points
-      get_auth_url '/api;driver=rhevm?force_auth=1'
+      get_auth_url '/api;driver=rhevm'
       (last_xml_response/'/api').first[:driver].should == 'rhevm'
       (last_xml_response/'/api/link').length.should > 0
     end
@@ -20,8 +27,8 @@ module RHEVMTest
       get_url '/api;driver=rhevm'
       features = (last_xml_response/'/api/link[@rel="instances"]/feature').collect { |f|
f[:name] }
       features.include?('user_name').should == true
-      features.include?('hardware_profiles').should == true
-      features.length.should == 3
+      features.include?('user_data').should == true
+      features.length.should == 2
     end
 
     def test_03_it_has_rhevm_collections
@@ -32,7 +39,8 @@ module RHEVMTest
       collections.include?('images').should == true
       collections.include?('realms').should == true
       collections.include?('hardware_profiles').should == true
-      collections.length.should == 8
+      collections.include?('storage_volumes').should == true
+      collections.length.should == 7
     end
 
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f40fb781/server/tests/drivers/rhevm/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/common.rb b/server/tests/drivers/rhevm/common.rb
new file mode 100644
index 0000000..1ab0f99
--- /dev/null
+++ b/server/tests/drivers/rhevm/common.rb
@@ -0,0 +1,11 @@
+ENV['API_USER']     = 'vdcadmin@rhev.lab.eng.brq.redhat.com'
+ENV['API_PASSWORD'] = '123456'
+ENV['API_PROVIDER'] = 'https://rhev30-dc.lab.eng.brq.redhat.com:8443/rhevm-api;645e425e-66fe-4ac9-8874-537bd10ef08d'
+
+require 'vcr'
+
+VCR.config do |c|
+  c.cassette_library_dir = "#{File.dirname(__FILE__)}/fixtures/"
+  c.stub_with :webmock
+  c.default_cassette_options = { :record => :none }
+end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f40fb781/server/tests/drivers/rhevm/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/hardware_profiles_test.rb b/server/tests/drivers/rhevm/hardware_profiles_test.rb
index e6323b8..f701fa9 100644
--- a/server/tests/drivers/rhevm/hardware_profiles_test.rb
+++ b/server/tests/drivers/rhevm/hardware_profiles_test.rb
@@ -1,13 +1,19 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
+DeltacloudTestCommon.record!
 module RHEVMTest
 
   class HardwareProfilesTest < Test::Unit::TestCase
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_it_returns_hardware_profiles

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f40fb781/server/tests/drivers/rhevm/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/images_test.rb b/server/tests/drivers/rhevm/images_test.rb
index 0b8a27b..3e9948a 100644
--- a/server/tests/drivers/rhevm/images_test.rb
+++ b/server/tests/drivers/rhevm/images_test.rb
@@ -1,17 +1,25 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
+DeltacloudTestCommon.record!
+
 module RHEVMTest
 
   class ImagesTest < Test::Unit::TestCase
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_it_returns_images
       get_auth_url '/api;driver=rhevm/images'
+      puts last_response.body
       (last_xml_response/'images/image').length.should > 0
     end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f40fb781/server/tests/drivers/rhevm/instances_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/instances_test.rb b/server/tests/drivers/rhevm/instances_test.rb
index 1f87a18..179eb98 100644
--- a/server/tests/drivers/rhevm/instances_test.rb
+++ b/server/tests/drivers/rhevm/instances_test.rb
@@ -1,13 +1,19 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
 
+DeltacloudTestCommon.record!
 module RHEVMTest
 
   class InstancesTest < Test::Unit::TestCase
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_01_it_can_create_instance_without_hardware_profile

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f40fb781/server/tests/drivers/rhevm/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/realms_test.rb b/server/tests/drivers/rhevm/realms_test.rb
index 5f84667..2c90578 100644
--- a/server/tests/drivers/rhevm/realms_test.rb
+++ b/server/tests/drivers/rhevm/realms_test.rb
@@ -1,13 +1,18 @@
 $:.unshift File.join(File.dirname(__FILE__), '..', '..', '..')
 require 'tests/common'
-
+DeltacloudTestCommon.record!
 module RHEVMTest
 
   class RealmsTest < Test::Unit::TestCase
     include Rack::Test::Methods
 
     def app
-      Sinatra::Application
+      Rack::Builder.new {
+        map '/' do
+          use Rack::Static, :urls => ["/stylesheets", "/javascripts"], :root => "public"
+          run Rack::Cascade.new([Deltacloud::API])
+        end
+      }
     end
 
     def test_01_it_returns_realms

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/f40fb781/server/tests/drivers/rhevm/setup.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/rhevm/setup.rb b/server/tests/drivers/rhevm/setup.rb
deleted file mode 100644
index 8c58ba2..0000000
--- a/server/tests/drivers/rhevm/setup.rb
+++ /dev/null
@@ -1,14 +0,0 @@
-ENV['API_USER']     = 'vdcadmin@rhev.lab.eng.brq.redhat.com'
-ENV['API_PASSWORD'] = '123456'
-ENV['API_PROVIDER'] = 'https://rhev30-dc.lab.eng.brq.redhat.com:8443/rhevm-api;645e425e-66fe-4ac9-8874-537bd10ef08d'
-
-require 'vcr'
-
-DeltacloudTestCommon::record!
-
-VCR.config do |c|
-  c.cassette_library_dir = "#{File.dirname(__FILE__)}/../../../tests/drivers/rhevm/fixtures/"
-  c.stub_with :webmock
-  c.default_cassette_options = { :record => :none }
-end
-


Mime
View raw message