deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject [4/7] git commit: Core: Fixed rack-test tests to use Rack::Builder
Date Wed, 12 Sep 2012 07:35:34 GMT
Core: Fixed rack-test tests to use Rack::Builder


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

Branch: refs/heads/master
Commit: a99310f0b3a05e21267cc6fd3837649cd6c6d0d4
Parents: 07febe4
Author: Michal Fojtik <mfojtik@redhat.com>
Authored: Thu Sep 6 14:19:38 2012 +0200
Committer: Michal fojtik <mfojtik@redhat.com>
Committed: Tue Sep 11 12:08:28 2012 +0200

----------------------------------------------------------------------
 .../cimi/collections/cloud_entry_point_test.rb     |    2 +-
 .../tests/cimi/collections/machine_images_test.rb  |    2 +-
 server/tests/cimi/collections/machines_test.rb     |    2 +-
 server/tests/deltacloud/base_collection_test.rb    |    5 -----
 .../collections/buckets_collection_test.rb         |    2 +-
 .../collections/drivers_collection_test.rb         |    2 +-
 .../hardware_profiles_collection_test.rb           |    2 +-
 .../collections/images_collection_test.rb          |    2 +-
 .../collections/instance_states_collection_test.rb |    2 +-
 .../collections/instances_collection_test.rb       |    2 +-
 .../deltacloud/collections/keys_collection_test.rb |    2 +-
 server/tests/deltacloud/server_test.rb             |    2 +-
 server/tests/test_helper.rb                        |   10 ++++++++++
 13 files changed, 21 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/cimi/collections/cloud_entry_point_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/collections/cloud_entry_point_test.rb b/server/tests/cimi/collections/cloud_entry_point_test.rb
index ba9764b..06eb3e9 100644
--- a/server/tests/cimi/collections/cloud_entry_point_test.rb
+++ b/server/tests/cimi/collections/cloud_entry_point_test.rb
@@ -7,7 +7,7 @@ require_relative './common.rb'
 describe CIMI::Collections::CloudEntryPoint do
 
   before do
-    def app; CIMI::API; end
+    def app; run_frontend(:cimi) end
     @collection = CIMI::Collections.collection(:cloudEntryPoint)
   end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/cimi/collections/machine_images_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/collections/machine_images_test.rb b/server/tests/cimi/collections/machine_images_test.rb
index 38fa0c4..d65212d 100644
--- a/server/tests/cimi/collections/machine_images_test.rb
+++ b/server/tests/cimi/collections/machine_images_test.rb
@@ -6,7 +6,7 @@ require_relative './common.rb'
 describe CIMI::Collections::MachineImages do
 
   before do
-    def app; CIMI::API; end
+    def app; run_frontend(:cimi) end
     authorize 'mockuser', 'mockpassword'
     @collection = CIMI::Collections.collection(:machine_images)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/cimi/collections/machines_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/cimi/collections/machines_test.rb b/server/tests/cimi/collections/machines_test.rb
index 77b319f..8d891c5 100644
--- a/server/tests/cimi/collections/machines_test.rb
+++ b/server/tests/cimi/collections/machines_test.rb
@@ -6,7 +6,7 @@ require_relative './common.rb'
 describe CIMI::Collections::Machines do
 
   before do
-    def app; CIMI::API; end
+    def app; run_frontend(:cimi) end
     authorize 'mockuser', 'mockpassword'
     @collection = CIMI::Collections.collection(:machines)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/deltacloud/base_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/base_collection_test.rb b/server/tests/deltacloud/base_collection_test.rb
index 65e2363..661862e 100644
--- a/server/tests/deltacloud/base_collection_test.rb
+++ b/server/tests/deltacloud/base_collection_test.rb
@@ -22,9 +22,4 @@ describe Deltacloud::Collections::Base do
     @base.version.must_equal  Deltacloud.config[:deltacloud].version
   end
 
-  it 'provides helper for routes' do
-    @base.must_respond_to :route_for
-    @base.route_for('/hardware_profiles').must_equal "#{Deltacloud.config[:deltacloud].root_url}/hardware_profiles"
-  end
-
 end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/deltacloud/collections/buckets_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/buckets_collection_test.rb b/server/tests/deltacloud/collections/buckets_collection_test.rb
index d33b412..80df01e 100644
--- a/server/tests/deltacloud/collections/buckets_collection_test.rb
+++ b/server/tests/deltacloud/collections/buckets_collection_test.rb
@@ -6,7 +6,7 @@ require_relative File.join('..', 'common.rb')
 describe Deltacloud::Collections::Buckets do
 
   before do
-    def app; Deltacloud::API; end
+    def app; run_frontend; end
     authorize 'mockuser', 'mockpassword'
     @collection = Deltacloud::Collections.collection(:buckets)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/deltacloud/collections/drivers_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/drivers_collection_test.rb b/server/tests/deltacloud/collections/drivers_collection_test.rb
index 296eba8..6e06a19 100644
--- a/server/tests/deltacloud/collections/drivers_collection_test.rb
+++ b/server/tests/deltacloud/collections/drivers_collection_test.rb
@@ -6,7 +6,7 @@ require_relative File.join('..', 'common.rb')
 describe Deltacloud::Collections::Drivers do
 
   before do
-    def app; Deltacloud::API; end
+    def app; run_frontend; end
     @collection = Deltacloud::Collections.collection(:drivers)
   end
 

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb b/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb
index 2f6cf59..9c8df37 100644
--- a/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb
+++ b/server/tests/deltacloud/collections/hardware_profiles_collection_test.rb
@@ -6,7 +6,7 @@ require_relative File.join('..', 'common.rb')
 describe Deltacloud::Collections::HardwareProfiles do
 
   before do
-    def app; Deltacloud::API; end
+    def app; run_frontend; end
     authorize 'mockuser', 'mockpassword'
     @collection = Deltacloud::Collections.collection(:hardware_profiles)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/deltacloud/collections/images_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/images_collection_test.rb b/server/tests/deltacloud/collections/images_collection_test.rb
index ad4f4c0..7b04ba3 100644
--- a/server/tests/deltacloud/collections/images_collection_test.rb
+++ b/server/tests/deltacloud/collections/images_collection_test.rb
@@ -6,7 +6,7 @@ require_relative File.join('..', 'common.rb')
 describe Deltacloud::Collections::Images do
 
   before do
-    def app; Deltacloud::API; end
+    def app; run_frontend; end
     authorize 'mockuser', 'mockpassword'
     @collection = Deltacloud::Collections.collection(:images)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/deltacloud/collections/instance_states_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/instance_states_collection_test.rb b/server/tests/deltacloud/collections/instance_states_collection_test.rb
index 768a19f..134b664 100644
--- a/server/tests/deltacloud/collections/instance_states_collection_test.rb
+++ b/server/tests/deltacloud/collections/instance_states_collection_test.rb
@@ -6,7 +6,7 @@ require_relative File.join('..', 'common.rb')
 describe Deltacloud::Collections::InstanceStates do
 
   before do
-    def app; Deltacloud::API; end
+    def app; run_frontend; end
     authorize 'mockuser', 'mockpassword'
     @collection = Deltacloud::Collections.collection(:instance_states)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/deltacloud/collections/instances_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/instances_collection_test.rb b/server/tests/deltacloud/collections/instances_collection_test.rb
index 668af4d..79c26ad 100644
--- a/server/tests/deltacloud/collections/instances_collection_test.rb
+++ b/server/tests/deltacloud/collections/instances_collection_test.rb
@@ -6,7 +6,7 @@ require_relative File.join('..', 'common.rb')
 describe Deltacloud::Collections::Instances do
 
   before do
-    def app; Deltacloud::API; end
+    def app; run_frontend; end
     authorize 'mockuser', 'mockpassword'
     @collection = Deltacloud::Collections.collection(:instances)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/deltacloud/collections/keys_collection_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/collections/keys_collection_test.rb b/server/tests/deltacloud/collections/keys_collection_test.rb
index 29b9653..c2e5635 100644
--- a/server/tests/deltacloud/collections/keys_collection_test.rb
+++ b/server/tests/deltacloud/collections/keys_collection_test.rb
@@ -6,7 +6,7 @@ require_relative File.join('..', 'common.rb')
 describe Deltacloud::Collections::Keys do
 
   before do
-    def app; Deltacloud::API; end
+    def app; run_frontend; end
     authorize 'mockuser', 'mockpassword'
     @collection = Deltacloud::Collections.collection(:keys)
   end

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/deltacloud/server_test.rb
----------------------------------------------------------------------
diff --git a/server/tests/deltacloud/server_test.rb b/server/tests/deltacloud/server_test.rb
index 4a18a37..0f02272 100644
--- a/server/tests/deltacloud/server_test.rb
+++ b/server/tests/deltacloud/server_test.rb
@@ -6,7 +6,7 @@ require_relative 'common.rb'
 describe Deltacloud::API do
 
   before do
-    def app; Deltacloud::API; end
+    def app; run_frontend; end
   end
 
   it 'has the config set property' do

http://git-wip-us.apache.org/repos/asf/deltacloud/blob/a99310f0/server/tests/test_helper.rb
----------------------------------------------------------------------
diff --git a/server/tests/test_helper.rb b/server/tests/test_helper.rb
index 57b7fb3..00ebcfa 100644
--- a/server/tests/test_helper.rb
+++ b/server/tests/test_helper.rb
@@ -32,6 +32,16 @@ end
 
 include Rack::Test::Methods
 
+def run_frontend(frontend=:deltacloud)
+  Rack::Builder.new {
+    use Rack::MatrixParams
+    map Deltacloud[frontend].root_url do
+      use Rack::MatrixParams
+      run Deltacloud[frontend].klass
+    end
+  }.to_app
+end
+
 def status; last_response.status; end
 def headers; last_response.headers; end
 def response_body; last_response.body; end


Mime
View raw message