mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fix test helpers
This commit is contained in:
parent
283a757a86
commit
a4b4e1ffd9
11 changed files with 15 additions and 163 deletions
|
@ -14,7 +14,9 @@ class AWS < Fog::Bin
|
|||
Fog::AWS::Compute.new
|
||||
when :elb
|
||||
Fog::AWS::ELB.new
|
||||
when :simpledb
|
||||
when :eu_storage
|
||||
Fog::AWS::Storage.new(:region => 'eu-west-1')
|
||||
when :sdb
|
||||
Fog::AWS::SimpleDB.new
|
||||
when :s3
|
||||
location = caller.first
|
||||
|
|
|
@ -124,6 +124,8 @@ module Fog
|
|||
@hmac = Fog::HMAC.new('sha1', @aws_secret_access_key)
|
||||
options[:region] ||= 'us-east-1'
|
||||
@host = options[:host] || case options[:region]
|
||||
when 'eu-west-1'
|
||||
's3-eu-west-1.amazonaws.com'
|
||||
when 'us-east-1'
|
||||
's3.amazonaws.com'
|
||||
when 'ap-southeast-1'
|
||||
|
|
|
@ -11,7 +11,7 @@ describe 'Fog::AWS::Compute::KeyPair' do
|
|||
'keyName' => 'name'
|
||||
)
|
||||
key_pair.fingerprint.should == 'fingerprint'
|
||||
key_pair.material.should == 'material'
|
||||
key_pair.private_key.should == 'material'
|
||||
key_pair.name.should == 'name'
|
||||
end
|
||||
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
require 'spec'
|
||||
require 'open-uri'
|
||||
require 'fog'
|
||||
Fog.bin = true
|
||||
require 'fog/bin'
|
||||
require 'fog/vcloud/bin'
|
||||
|
||||
|
@ -8,83 +9,6 @@ if ENV["FOG_MOCK"] == "true"
|
|||
Fog.mock!
|
||||
end
|
||||
|
||||
module AWS
|
||||
class << self
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k, v|
|
||||
![:aws_access_key_id, :aws_secret_access_key].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::AWS::Compute.new(credentials)
|
||||
when :eu_storage
|
||||
Fog::AWS::Storage.new(credentials.merge!(:host => 's3-external-3.amazonaws.com'))
|
||||
when :sdb
|
||||
Fog::AWS::SimpleDB.new(credentials)
|
||||
when :storage
|
||||
Fog::AWS::Storage.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Rackspace
|
||||
class << self
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k, v|
|
||||
![:rackspace_api_key, :rackspace_username].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Rackspace::Compute.new(credentials)
|
||||
when :storage
|
||||
Fog::Rackspace::Storage.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Slicehost
|
||||
class << self
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k, v|
|
||||
![:slicehost_password].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Slicehost::Compute.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
module Bluebox
|
||||
class << self
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k,v|
|
||||
![:bluebox_api_key, :bluebox_customer_id].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Bluebox::Compute.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def eventually(max_delay = 16, &block)
|
||||
delays = [0]
|
||||
delay_step = 1
|
||||
|
|
|
@ -21,7 +21,7 @@ if Fog.mocking?
|
|||
end
|
||||
|
||||
context "as a collection member" do
|
||||
subject { p @vcloud.vdcs[0]; @vcloud.vdcs[0].reload; @vcloud.vdcs[0] }
|
||||
subject { @vcloud.vdcs[0].reload; @vcloud.vdcs[0] }
|
||||
|
||||
it { should be_an_instance_of Fog::Vcloud::Vdc }
|
||||
|
||||
|
|
|
@ -1,25 +1,4 @@
|
|||
module AWS
|
||||
|
||||
class << self
|
||||
def [](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k, v|
|
||||
![:aws_access_key_id, :aws_secret_access_key].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::AWS::Compute.new(credentials)
|
||||
when :eu_storage
|
||||
Fog::AWS::Storage.new(credentials.merge!(:host => 's3-external-3.amazonaws.com'))
|
||||
when :sdb
|
||||
Fog::AWS::SimpleDB.new(credentials)
|
||||
when :storage
|
||||
Fog::AWS::Storage.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
end
|
||||
class AWS
|
||||
|
||||
module Compute
|
||||
|
||||
|
|
|
@ -1,17 +1,4 @@
|
|||
module Bluebox
|
||||
|
||||
def self.[](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k,v|
|
||||
![:bluebox_api_key, :bluebox_customer_id].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Bluebox::Compute.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
class Bluebox
|
||||
|
||||
module Compute
|
||||
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog'))
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), '..', 'lib', 'fog', 'bin'))
|
||||
require 'fog'
|
||||
require 'fog/bin'
|
||||
Fog.bin = true
|
||||
|
||||
require File.expand_path(File.join(File.dirname(__FILE__), 'helpers', 'model_helper'))
|
||||
|
||||
|
|
|
@ -1,17 +1,4 @@
|
|||
module Linode
|
||||
|
||||
def self.[](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k,v|
|
||||
![:linode_api_key].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Linode::Compute.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
class Linode
|
||||
|
||||
module Compute
|
||||
|
||||
|
|
|
@ -1,19 +1,4 @@
|
|||
module Rackspace
|
||||
|
||||
def self.[](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k, v|
|
||||
![:rackspace_api_key, :rackspace_username].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Rackspace::Compute.new(credentials)
|
||||
when :storage
|
||||
Fog::Rackspace::Storage.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
class Rackspace
|
||||
|
||||
module Compute
|
||||
|
||||
|
|
|
@ -1,16 +1 @@
|
|||
module Slicehost
|
||||
|
||||
def self.[](service)
|
||||
@@connections ||= Hash.new do |hash, key|
|
||||
credentials = Fog.credentials.reject do |k, v|
|
||||
![:slicehost_password].include?(k)
|
||||
end
|
||||
hash[key] = case key
|
||||
when :compute
|
||||
Fog::Slicehost::Compute.new(credentials)
|
||||
end
|
||||
end
|
||||
@@connections[service]
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue