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:
parent
7504ecf31c
commit
9e371377de
4 changed files with 16 additions and 40 deletions
|
@ -182,7 +182,18 @@ module Fog
|
||||||
:servers => {},
|
:servers => {},
|
||||||
:key_pairs => {},
|
:key_pairs => {},
|
||||||
:security_groups => {},
|
: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
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,18 +19,7 @@ module Fog
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
response.body = {
|
response.body = {
|
||||||
'quota_set' => {
|
'quota_set' => (self.data[:quota_updated] or self.data[:quota]).merge({'id' => tenant_id})
|
||||||
'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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -19,18 +19,7 @@ module Fog
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
response.body = {
|
response.body = {
|
||||||
'quota_set' => {
|
'quota_set' => self.data[:quota].merge({'id' => tenant_id})
|
||||||
'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
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,24 +18,11 @@ module Fog
|
||||||
class Mock
|
class Mock
|
||||||
|
|
||||||
def update_quota(tenant_id, options = {})
|
def update_quota(tenant_id, options = {})
|
||||||
defaults = {
|
self.data[:quota_updated] = self.data[:quota].merge options
|
||||||
'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
|
|
||||||
|
|
||||||
response = Excon::Response.new
|
response = Excon::Response.new
|
||||||
response.status = 200
|
response.status = 200
|
||||||
response.body = { 'quota_set' => options }
|
response.body = { 'quota_set' => self.data[:quota_updated] }
|
||||||
response
|
response
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue