1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

storage_tests now all pass under mocking, too.

Refactored a few more Storage service utilities into Common to do so.
This commit is contained in:
Ash Wilson 2013-12-20 11:07:15 -05:00
parent ed56b17bab
commit 4e309df4e2
3 changed files with 17 additions and 13 deletions

View file

@ -43,7 +43,7 @@ module Fog
@auth_token = data['access']['token']['id']
end
def interpret_options(options)
def apply_options(options)
@rackspace_username = options[:rackspace_username]
@rackspace_api_key = options[:rackspace_api_key]
@rackspace_region = options[:rackspace_region]
@ -63,7 +63,7 @@ module Fog
include Common
def initialize(options={})
interpret_options(options)
apply_options(options)
authenticate
end
@ -73,7 +73,7 @@ module Fog
include Common
def initialize(options={})
interpret_options(options)
apply_options(options)
@connection = Fog::Connection.new(@uri.to_s, @persistent, @connection_options)
authenticate

View file

@ -104,6 +104,11 @@ module Fog
@rackspace_region
end
def endpoint_uri(service_endpoint_url=nil)
return @uri if @uri
super(@rackspace_storage_url || service_endpoint_url, :rackspace_storage_url)
end
# Return Account Details
# @return [Fog::Storage::Rackspace::Account] account details object
def account
@ -241,6 +246,14 @@ module Fog
def ssl?
!!@rackspace_cdn_ssl
end
private
def authenticate_v1(options)
uuid = Fog::Rackspace::MockData.uuid
endpoint_uri "https://storage101.#{region}1.clouddrive.com/v1/MockCloudFS_#{uuid}"
@auth_token = Fog::Mock.random_hex(32)
end
end
class Real < Fog::Rackspace::Service
@ -281,11 +294,6 @@ module Fog
raise ServiceError.slurp(error, self)
end
def endpoint_uri(service_endpoint_url=nil)
return @uri if @uri
super(@rackspace_storage_url || service_endpoint_url, :rackspace_storage_url)
end
private
def authenticate_v1(options)

View file

@ -38,7 +38,6 @@ Shindo.tests('Rackspace | Storage', ['rackspace']) do
end
tests('authentation v2') do
pending if Fog.mocking?
tests('variables populated').succeeds do
@service = Fog::Storage::Rackspace.new :rackspace_auth_url => 'https://identity.api.rackspacecloud.com/v2.0', :connection_options => { :ssl_verify_peer => true }
@ -71,7 +70,6 @@ Shindo.tests('Rackspace | Storage', ['rackspace']) do
end
tests('default auth') do
pending if Fog.mocking?
tests('no params').succeeds do
@service = Fog::Storage::Rackspace.new :rackspace_region => nil
@ -98,7 +96,6 @@ Shindo.tests('Rackspace | Storage', ['rackspace']) do
end
tests('reauthentication') do
pending if Fog.mocking?
tests('should reauth with valid credentials') do
@service = Fog::Storage::Rackspace.new
@ -112,8 +109,7 @@ Shindo.tests('Rackspace | Storage', ['rackspace']) do
end
tests('account').succeeds do
pending if Fog.mocking?
Fog::Storage[:rackspace].account
Fog::Storage[:rackspace].account
end
tests('ssl') do