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

[aws] segregate mock data by region

This commit is contained in:
geemus 2010-09-24 13:50:44 -07:00
parent a291086009
commit cdca74ff6a
2 changed files with 53 additions and 47 deletions

View file

@ -67,8 +67,9 @@ module Fog
class Mock
def self.data
@data ||= Hash.new do |hash, key|
@data ||= Hash.new do |hash, region|
owner_id = Fog::AWS::Mock.owner_id
hash[region] = Hash.new do |hash, key|
hash[key] = {
:deleted_at => {},
:addresses => {},
@ -111,6 +112,7 @@ module Fog
}
end
end
end
def self.reset_data(keys=data.keys)
for key in [*keys]
@ -120,7 +122,8 @@ module Fog
def initialize(options={})
@aws_access_key_id = options[:aws_access_key_id]
@data = self.class.data[@aws_access_key_id]
@region = options[:region] || 'us-east-1'
@data = self.class.data[@region][@aws_access_key_id]
@owner_id = @data[:owner_id]
end

View file

@ -74,12 +74,14 @@ module Fog
include Utils
def self.data
@data ||= Hash.new do |hash, key|
@data ||= Hash.new do |hash, region|
hash[region] = Hash.new do |hash, key|
hash[key] = {
:buckets => {}
}
end
end
end
def self.reset_data(keys=data.keys)
for key in [*keys]
@ -89,7 +91,8 @@ module Fog
def initialize(options={})
@aws_access_key_id = options[:aws_access_key_id]
@data = self.class.data[@aws_access_key_id]
@region = options[:region] || 'us-east-1'
@data = self.class.data[@region][@aws_access_key_id]
end
def signature(params)