1
0
Fork 0
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:
geemus 2010-09-23 10:48:52 -07:00
parent 283a757a86
commit a4b4e1ffd9
11 changed files with 15 additions and 163 deletions

View file

@ -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

View file

@ -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'

View file

@ -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

View file

@ -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

View file

@ -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 }

View file

@ -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

View file

@ -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

View file

@ -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'))

View file

@ -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

View file

@ -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

View file

@ -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