deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [24/50] [abbrv] git commit: Test: Make possible to run the Openstack unit test
Date Tue, 22 May 2012 20:19:37 GMT
Test: Make possible to run the Openstack unit test


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

Branch: refs/heads/master
Commit: 7885d39cd422cf4896dab17b86a18e970bb3b7bd
Parents: 17b3b6e
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Tue May 15 23:37:03 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue May 22 22:17:37 2012 +0200

----------------------------------------------------------------------
 server/tests/common.rb                             |   15 +++++++--------
 server/tests/drivers/openstack/api_test.rb         |    7 ++++++-
 .../drivers/openstack/hardware_profiles_test.rb    |    7 ++++++-
 server/tests/drivers/openstack/images_test.rb      |    7 ++++++-
 server/tests/drivers/openstack/instances_test.rb   |    7 ++++++-
 server/tests/drivers/openstack/realms_test.rb      |    7 ++++++-
 6 files changed, 37 insertions(+), 13 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7885d39c/server/tests/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/common.rb b/server/tests/common.rb
index 528f86d..9d557cf 100644
--- a/server/tests/common.rb
+++ b/server/tests/common.rb
@@ -28,9 +28,14 @@ require 'json'
 require 'digest/sha1'
 require 'base64'
 require 'rack/test'
-require "%s/server" % (ENV['API_FRONTEND'] == 'cimi' ? 'cimi' : 'deltacloud')
 
-driver
+load File.join(File.dirname(__FILE__), '..', 'lib', 'deltacloud_rack.rb')
+
+Deltacloud::configure do |server|
+  server.root_url '/api'
+  server.version '0.5.0'
+  server.klass 'Deltacloud::API'
+end.require_frontend!
 
 # Set proper environment variables for running test
 
@@ -38,12 +43,6 @@ ENV['RACK_ENV']     = 'test'
 ENV['API_HOST']     = 'localhost'
 ENV['API_PORT']     = '4040'
 
-configure :test do
-  set :environment, :test
-  set :raise_errors, false
-  set :show_exceptions, false
-end
-
 RSpec.configure do |conf|
   conf.include Rack::Test::Methods
   conf.expect_with :rspec

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7885d39c/server/tests/drivers/openstack/api_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/api_test.rb b/server/tests/drivers/openstack/api_test.rb
index 14861b0..b9c3fb2 100644
--- a/server/tests/drivers/openstack/api_test.rb
+++ b/server/tests/drivers/openstack/api_test.rb
@@ -7,7 +7,12 @@ module OpenstackTest
     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_entry_points

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7885d39c/server/tests/drivers/openstack/common.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/common.rb b/server/tests/drivers/openstack/common.rb
new file mode 100644
index 0000000..e69de29

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7885d39c/server/tests/drivers/openstack/hardware_profiles_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/hardware_profiles_test.rb b/server/tests/drivers/openstack/hardware_profiles_test.rb
index 0744011..68a4f0c 100644
--- a/server/tests/drivers/openstack/hardware_profiles_test.rb
+++ b/server/tests/drivers/openstack/hardware_profiles_test.rb
@@ -7,7 +7,12 @@ module OpenstackTest
     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/7885d39c/server/tests/drivers/openstack/images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/images_test.rb b/server/tests/drivers/openstack/images_test.rb
index 9b71653..3049364 100644
--- a/server/tests/drivers/openstack/images_test.rb
+++ b/server/tests/drivers/openstack/images_test.rb
@@ -7,7 +7,12 @@ module OpenstackTest
     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

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/7885d39c/server/tests/drivers/openstack/instances_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/instances_test.rb b/server/tests/drivers/openstack/instances_test.rb
index c2e2b76..d7da173 100644
--- a/server/tests/drivers/openstack/instances_test.rb
+++ b/server/tests/drivers/openstack/instances_test.rb
@@ -7,7 +7,12 @@ module OpenstackTest
     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/7885d39c/server/tests/drivers/openstack/realms_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/drivers/openstack/realms_test.rb b/server/tests/drivers/openstack/realms_test.rb
index f62a6f9..613e5ec 100644
--- a/server/tests/drivers/openstack/realms_test.rb
+++ b/server/tests/drivers/openstack/realms_test.rb
@@ -7,7 +7,12 @@ module OpenstackTest
     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


Mime
View raw message