incubator-deltacloud-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mfoj...@apache.org
Subject svn commit: r1080537 - in /incubator/deltacloud/trunk/server: lib/sinatra/rack_matrix_params.rb tests/drivers/mock/api_test.rb
Date Fri, 11 Mar 2011 11:44:54 GMT
Author: mfojtik
Date: Fri Mar 11 11:44:53 2011
New Revision: 1080537

URL: http://svn.apache.org/viewvc?rev=1080537&view=rev
Log:
Added unit tests for matrix params and driver switching

Modified:
    incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb
    incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb

Modified: incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb?rev=1080537&r1=1080536&r2=1080537&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb (original)
+++ incubator/deltacloud/trunk/server/lib/sinatra/rack_matrix_params.rb Fri Mar 11 11:44:53
2011
@@ -40,8 +40,8 @@ module Rack
     # regular <form> parameters.
     
     def call(env)
-      # Return if this header is not set properly (Rack::Test case...)
-      return @app.call(env) unless env['REQUEST_URI']
+      # Copy PATH_INFO to REQUEST_URI if Rack::Test
+      env['REQUEST_URI'] = env['PATH_INFO'] if env['rack.test']
 
       # Split URI to components and then extract ;var=value pairs
       uri_components = env['REQUEST_URI'].split('/')

Modified: incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb
URL: http://svn.apache.org/viewvc/incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb?rev=1080537&r1=1080536&r2=1080537&view=diff
==============================================================================
--- incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb (original)
+++ incubator/deltacloud/trunk/server/tests/drivers/mock/api_test.rb Fri Mar 11 11:44:53 2011
@@ -89,5 +89,16 @@ module DeltacloudUnitTest
       (last_xml_response/'api/drivers/driver[@id=ec2]/entrypoints/entrypoint').first.text.should_not
== ""
     end
 
+    def test_it_supports_matrix_params
+      do_xml_request "/api;driver=ec2"
+      last_response.status.should == 200
+      (last_xml_response/'api').first[:driver].should == 'ec2'
+      do_xml_request "/api;driver=mock"
+      (last_xml_response/'api').first[:driver].should == 'mock'
+      do_xml_request "/api;driver=ec2/hardware_profiles"
+      (last_xml_response/'hardware_profiles/hardware_profile/@id').map {|n| n.to_s}.include?('m1.small').should
== true
+      last_response.status.should == 200
+    end
+
   end
 end



Mime
View raw message