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

Rework the quota mock testing to work and be more comfortable

This commit is contained in:
Bohuslav Kabrda 2012-07-02 10:27:09 +02:00
parent 7504ecf31c
commit 9e371377de
4 changed files with 16 additions and 40 deletions

View file

@ -182,7 +182,18 @@ module Fog
:servers => {},
:key_pairs => {},
:security_groups => {},
:addresses => {}
:addresses => {},
:quota => {
'metadata_items' => 128,
'injected_file_content_bytes' => 10240,
'injected_files' => 5,
'gigabytes' => 1000,
'ram' => 51200,
'floating_ips' => 10,
'instances' => 10,
'volumes' => 10,
'cores' => 20,
}
}
end
end

View file

@ -19,18 +19,7 @@ module Fog
response = Excon::Response.new
response.status = 200
response.body = {
'quota_set' => {
'metadata_items' => 128,
'injected_file_content_bytes' => 10240,
'injected_files' => 5,
'gigabytes' => 1000,
'ram' => 51200,
'floating_ips' => 10,
'instances' => 10,
'volumes' => 10,
'cores' => 20,
'id' => tenant_id
}
'quota_set' => (self.data[:quota_updated] or self.data[:quota]).merge({'id' => tenant_id})
}
response
end

View file

@ -19,18 +19,7 @@ module Fog
response = Excon::Response.new
response.status = 200
response.body = {
'quota_set' => {
'metadata_items' => 128,
'injected_file_content_bytes' => 10240,
'injected_files' => 5,
'gigabytes' => 1000,
'ram' => 51200,
'floating_ips' => 10,
'instances' => 10,
'volumes' => 10,
'cores' => 20,
'id' => tenant_id
}
'quota_set' => self.data[:quota].merge({'id' => tenant_id})
}
response
end

View file

@ -18,24 +18,11 @@ module Fog
class Mock
def update_quota(tenant_id, options = {})
defaults = {
'metadata_items' => 128,
'injected_file_content_bytes' => 10240,
'injected_files' => 5,
'gigabytes' => 1000,
'ram' => 51200,
'floating_ips' => 10,
'instances' => 10,
'volumes' => 10,
'cores' => 20,
'id' => tenant_id
}
defaults.merge options
self.data[:quota_updated] = self.data[:quota].merge options
response = Excon::Response.new
response.status = 200
response.body = { 'quota_set' => options }
response.body = { 'quota_set' => self.data[:quota_updated] }
response
end