2013-02-19 15:43:06 -05:00
|
|
|
Shindo.tests('Rackspace | Storage', ['rackspace']) do
|
|
|
|
|
|
|
|
def assert_method(url, method)
|
2013-02-19 17:05:17 -05:00
|
|
|
@service.instance_variable_set "@rackspace_auth_url", url
|
2013-02-19 15:43:06 -05:00
|
|
|
returns(method) { @service.send :authentication_method }
|
|
|
|
end
|
|
|
|
|
|
|
|
tests('#authentication_method') do
|
|
|
|
@service = Fog::Storage::Rackspace.new
|
2013-02-26 10:52:53 -05:00
|
|
|
|
2013-02-19 15:43:06 -05:00
|
|
|
assert_method nil, :authenticate_v2
|
2013-02-26 10:52:53 -05:00
|
|
|
|
|
|
|
assert_method 'https://identity.api.rackspacecloud.com', :authenticate_v1
|
2013-02-19 15:43:06 -05:00
|
|
|
assert_method 'https://identity.api.rackspacecloud.com/v1', :authenticate_v1
|
|
|
|
assert_method 'https://identity.api.rackspacecloud.com/v1.1', :authenticate_v1
|
|
|
|
assert_method 'https://identity.api.rackspacecloud.com/v2.0', :authenticate_v2
|
|
|
|
|
2013-02-26 10:52:53 -05:00
|
|
|
assert_method 'https://lon.identity.api.rackspacecloud.com', :authenticate_v1
|
2013-02-19 15:43:06 -05:00
|
|
|
assert_method 'https://lon.identity.api.rackspacecloud.com/v1', :authenticate_v1
|
|
|
|
assert_method 'https://lon.identity.api.rackspacecloud.com/v1.1', :authenticate_v1
|
|
|
|
assert_method 'https://lon.identity.api.rackspacecloud.com/v2.0', :authenticate_v2
|
|
|
|
end
|
|
|
|
|
2013-02-20 14:02:32 -05:00
|
|
|
tests('authentication v1') do
|
2013-02-19 15:43:06 -05:00
|
|
|
pending if Fog.mocking?
|
|
|
|
|
2013-03-15 17:38:33 -04:00
|
|
|
tests('variables populated').succeeds do
|
|
|
|
@service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0'
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
|
2013-02-20 10:04:56 -05:00
|
|
|
returns(false, "path populated") { @service.instance_variable_get("@uri").nil? }
|
2013-03-15 17:38:33 -04:00
|
|
|
returns(true, "identity_service was not used") { @service.instance_variable_get("@identity_service").nil? }
|
|
|
|
@service.head_containers
|
2013-02-19 15:43:06 -05:00
|
|
|
end
|
2013-02-20 14:02:32 -05:00
|
|
|
tests('custom endpoint') do
|
|
|
|
@service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v1.0',
|
|
|
|
:rackspace_storage_url => 'https://my-custom-endpoint.com'
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(false, "auth token populated") { @service.send(:auth_token).nil? }
|
2013-02-20 14:02:32 -05:00
|
|
|
returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil }
|
|
|
|
end
|
2013-02-19 15:43:06 -05:00
|
|
|
end
|
|
|
|
|
2013-02-20 14:02:32 -05:00
|
|
|
tests('authentation v2') do
|
2013-02-19 15:43:06 -05:00
|
|
|
pending if Fog.mocking?
|
|
|
|
|
2013-03-15 17:38:33 -04:00
|
|
|
tests('variables populated').succeeds do
|
|
|
|
@service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0'
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
|
2013-02-20 10:04:56 -05:00
|
|
|
returns(false, "path populated") { @service.instance_variable_get("@uri").nil? }
|
2013-03-15 17:38:33 -04:00
|
|
|
returns(false, "identity service was used") { @service.instance_variable_get("@identity_service").nil? }
|
|
|
|
@service.head_containers
|
2013-02-19 15:43:06 -05:00
|
|
|
end
|
2013-03-15 17:38:33 -04:00
|
|
|
tests('dfw region').succeeds do
|
2013-02-19 15:43:06 -05:00
|
|
|
@service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :dfw
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
|
2013-02-20 10:04:56 -05:00
|
|
|
returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw\d/) != nil }
|
2013-03-15 17:38:33 -04:00
|
|
|
@service.head_containers
|
2013-02-19 15:43:06 -05:00
|
|
|
end
|
2013-03-15 17:38:33 -04:00
|
|
|
tests('ord region').succeeds do
|
2013-02-19 15:43:06 -05:00
|
|
|
@service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :rackspace_region => :ord
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
|
2013-02-20 10:04:56 -05:00
|
|
|
returns(true) { (@service.instance_variable_get("@uri").host =~ /ord\d/) != nil }
|
2013-03-15 17:38:33 -04:00
|
|
|
@service.head_containers
|
2013-02-20 10:04:56 -05:00
|
|
|
end
|
2013-03-15 17:38:33 -04:00
|
|
|
tests('custom endpoint').succeeds do
|
2013-02-20 14:02:32 -05:00
|
|
|
@service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0',
|
2013-02-20 10:04:56 -05:00
|
|
|
:rackspace_storage_url => 'https://my-custom-endpoint.com'
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
|
2013-02-20 10:04:56 -05:00
|
|
|
returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil }
|
2013-02-19 15:43:06 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2013-02-20 14:02:32 -05:00
|
|
|
tests('default auth') do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
|
2013-03-15 17:38:33 -04:00
|
|
|
tests('no params').succeeds do
|
2013-02-20 14:02:32 -05:00
|
|
|
@service = Fog::Storage::Rackspace.new
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
|
2013-02-20 14:02:32 -05:00
|
|
|
returns(true) { (@service.instance_variable_get("@uri").host =~ /dfw\d/) != nil }
|
2013-03-15 17:38:33 -04:00
|
|
|
@service.head_containers
|
2013-02-20 14:02:32 -05:00
|
|
|
end
|
2013-03-15 17:38:33 -04:00
|
|
|
tests('specify region').succeeds do
|
2013-02-20 14:02:32 -05:00
|
|
|
@service = Fog::Storage::Rackspace.new :rackspace_region => :ord
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
|
2013-02-20 14:02:32 -05:00
|
|
|
returns(true) { (@service.instance_variable_get("@uri").host =~ /ord\d/ ) != nil }
|
2013-03-15 17:38:33 -04:00
|
|
|
@service.head_containers
|
2013-02-20 14:02:32 -05:00
|
|
|
end
|
|
|
|
tests('custom endpoint') do
|
|
|
|
@service = Fog::Storage::Rackspace.new :rackspace_storage_url => 'https://my-custom-endpoint.com'
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
|
2013-02-20 14:02:32 -05:00
|
|
|
returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /my-custom-endpoint\.com/) != nil }
|
|
|
|
end
|
|
|
|
tests('rackspace_servicenet') do
|
|
|
|
@service = Fog::Storage::Rackspace.new :rackspace_servicenet => true
|
2013-03-01 15:48:26 -05:00
|
|
|
returns(true, "auth token populated") { !@service.send(:auth_token).nil? }
|
2013-02-20 14:02:32 -05:00
|
|
|
returns(true, "uses custom endpoint") { (@service.instance_variable_get("@uri").host =~ /snet-/) != nil }
|
|
|
|
end
|
|
|
|
end
|
2013-03-04 14:42:36 -05:00
|
|
|
|
2013-02-15 15:26:45 -05:00
|
|
|
tests('account').succeeds do
|
2013-03-04 14:42:36 -05:00
|
|
|
pending if Fog.mocking?
|
2013-02-15 15:26:45 -05:00
|
|
|
Fog::Storage[:rackspace].account
|
|
|
|
end
|
2013-02-19 15:43:06 -05:00
|
|
|
end
|
2013-02-28 10:21:37 -05:00
|
|
|
|