From e627d60064b56b0f52b57c7fee6a0aa67c278247 Mon Sep 17 00:00:00 2001 From: marios <marios@redhat.com> Date: Thu, 21 Feb 2013 15:28:34 +0200 Subject: [PATCH] Fix Failing tests - required for rpm packaging for deltacloud 1.1.1 http://kojipkgs.fedoraproject.org//work/tasks/9300/5039300/build.log --- test/authentication_test.rb | 24 +++++------------------- 1 file changed, 5 insertions(+), 19 deletions(-) diff --git a/test/authentication_test.rb b/test/authentication_test.rb index 4f3d612..c817274 100644 --- a/test/authentication_test.rb +++ b/test/authentication_test.rb @@ -33,35 +33,21 @@ class AuthenticationTest < Test::Unit::TestCase end end - def test_service_region + def test_service_uri server = get_test_auth_server Net::HTTP.stubs(:new).returns(server) server.stubs(:started?).returns(true) - connection = stub(:authuser => 'good_user', :auth_method => "password",:authtenant => {:type=>"tenantName", :value=>'good_tenant'} , :authkey => 'bad_key', :auth_host => "a.b.c", :auth_port => "443", :auth_scheme => "https", :auth_path => "/v2.0", :authok= => true, :authtoken= => true, :service_host= => "", :service_path= => "", :service_path => "", :service_port= => "", :service_scheme= => "", :proxy_host => nil, :proxy_port => nil, :api_path => '/foo', :service_type => "compute", :service_name => "cloudServers", :region => "South") + connection = v2_auth_connection_stub result = OpenStack::Authentication.init(connection) assert_equal("compute.south.host", result.uri.host) end - def test_service_name - server = get_test_auth_server - Net::HTTP.stubs(:new).returns(server) - server.stubs(:started?).returns(true) - connection = stub(:authuser => 'good_user', :auth_method=>"password", :authtenant => {:type=>"tenantName", :value=>'good_tenant'}, :authkey => 'bad_key', :auth_host => "a.b.c", :auth_port => "443", :auth_scheme => "https", :auth_path => "/v2.0", :authok= => true, :authtoken= => true, :service_host= => "", :service_path= => "", :service_path => "", :service_port= => "", :service_scheme= => "", :proxy_host => nil, :proxy_port => nil, :api_path => '/foo', :service_type => "nova", :service_name => "cloudCompute", :region => "South") - result = OpenStack::Authentication.init(connection) - assert_equal("nova.south.host", result.uri.host) - end + private - def test_service_type - server = get_test_auth_server - Net::HTTP.stubs(:new).returns(server) - server.stubs(:started?).returns(true) - connection = stub(:authuser => 'good_user', :auth_method => "password", :authtenant => {:type=>"tenantName", :value=>'good_tenant'}, :authkey => 'bad_key', :auth_host => "a.b.c", :auth_port => "443", :auth_scheme => "https", :auth_path => "/v2.0", :authok= => true, :authtoken= => true, :service_host= => "", :service_path= => "", :service_path => "", :service_port= => "", :service_scheme= => "", :proxy_host => nil, :proxy_port => nil, :api_path => '/foo', :service_type => "nova", :service_name => nil, :region => "North") - result = OpenStack::Authentication.init(connection) - assert_equal("nova.north.host", result.uri.host) + def v2_auth_connection_stub + stub(:authuser => 'good_user', :auth_method => "password",:authtenant => {:type=>"tenantName", :value=>'good_tenant'} , :regions_list => {"North"=> [{:service=>"compute", :versionId=>nil}, {:service=>"nova", :versionId=>nil}], "South"=>[{:service=>"compute", :versionId=>nil}, {:service=>"nova", :versionId=>nil}] }, :authkey => 'bad_key', :auth_host => "a.b.c", :auth_port => "443", :auth_scheme => "https", :auth_path => "/v2.0", :authok= => true, :authtoken= => true, :service_host= => "", :service_path= => "", :service_path => "", :service_port= => "", :service_scheme= => "", :proxy_host => nil, :proxy_port => nil, :api_path => '/foo', :service_type => "compute", :service_name => "cloudServers", :region => "South") end - - private def get_test_auth_server json_response = %{{ "access":{ -- 1.8.1.2