test/yao/test_auth.rb in yao-0.3.2 vs test/yao/test_auth.rb in yao-0.3.3
- old
+ new
@@ -1,10 +1,10 @@
class TestAuth < Test::Unit::TestCase
include AuthStub
def setup
- @auth_url = "http://endpoint.example.com:12345"
+ @auth_url = "http://endpoint.example.com:12345/v2.0"
username = "udzura"
tenant = "example"
password = "XXXXXXXX"
stub_auth_request(@auth_url, username, password, tenant)
@@ -19,11 +19,11 @@
end
end
def test_auth_successful
cli = Yao.default_client.pool["default"]
- assert { cli.url_prefix.to_s == "http://endpoint.example.com:12345/" }
+ assert { cli.url_prefix.to_s == "http://endpoint.example.com:12345/v2.0" }
end
def test_service_sclients_initialized
%w(compute network image identity).each do |service|
cli = Yao.default_client.pool[service]
@@ -51,26 +51,40 @@
def test_hooked_by_configure_block
auth = Yao::Auth
stub(auth).new
Yao.configure do
- auth_url "http://endpoint.example.com:12345"
+ auth_url "http://endpoint.example.com:12345/v2.0"
tenant_name "example"
username "udzura"
password "XXXXXXXX"
end
assert_received(auth) {|a| a.new }
end
def test_override_endpoint
Yao.configure do
- auth_url "http://endpoint.example.com:12345"
+ auth_url "http://endpoint.example.com:12345/v2.0"
tenant_name "example"
username "udzura"
password "XXXXXXXX"
endpoints ({ identity: { public: "http://override-endpoint.example.com:35357/v3.0" } })
end
- assert(Yao.default_client.pool["identity"].url_prefix.to_s, "http://override-endpoint.example.com:35357/v3.0")
+ assert { Yao.default_client.pool["identity"].url_prefix.to_s == "http://override-endpoint.example.com:35357/v3.0" }
end
+ def test_region
+ Yao.configure do
+ auth_url "http://endpoint.example.com:12345/v2.0"
+ tenant_name "example"
+ username "udzura"
+ password "XXXXXXXX"
+ region_name "RegionTest"
+ end
+ assert { Yao.default_client.pool["identity"].url_prefix.to_s == "https://global-endpoint.example.com/api/keystone/" }
+ ensure
+ Yao.configure do
+ region_name "RegionOne"
+ end
+ end
end