mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[rackspace|compute] fill in flavor mocks
This commit is contained in:
parent
0a045b0552
commit
f137582465
3 changed files with 47 additions and 3 deletions
|
@ -25,7 +25,25 @@ module Fog
|
|||
class Mock
|
||||
|
||||
def get_flavor_details(flavor_id)
|
||||
Fog::Mock.not_implemented
|
||||
response = Excon::Response.new
|
||||
flavor = {
|
||||
1 => { 'name' => '256 server', 'ram' => 256, 'disk' => 10 },
|
||||
2 => { 'name' => '512 server', 'ram' => 512, 'disk' => 20 },
|
||||
3 => { 'name' => '1GB server', 'ram' => 1024, 'disk' => 40 },
|
||||
4 => { 'name' => '2GB server', 'ram' => 2048, 'disk' => 80 },
|
||||
5 => { 'name' => '4GB server', 'ram' => 4096, 'disk' => 160 },
|
||||
6 => { 'name' => '8GB server', 'ram' => 8192, 'disk' => 320 },
|
||||
7 => { 'name' => '15.5GB server', 'ram' => 15872, 'disk' => 620 }
|
||||
}[flavor_id]
|
||||
if flavor
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'flavor' => flavor
|
||||
}
|
||||
response
|
||||
else
|
||||
raise Fog::Rackspace::Compute::NotFound
|
||||
end
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -23,7 +23,20 @@ module Fog
|
|||
class Mock
|
||||
|
||||
def list_flavors
|
||||
Fog::Mock.not_implemented
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'flavors' => [
|
||||
{ 'name' => '256 server', 'id' => 1 },
|
||||
{ 'name' => '512 server', 'id' => 2 },
|
||||
{ 'name' => '1GB server', 'id' => 3 },
|
||||
{ 'name' => '2GB server', 'id' => 4 },
|
||||
{ 'name' => '4GB server', 'id' => 5 },
|
||||
{ 'name' => '8GB server', 'id' => 6 },
|
||||
{ 'name' => '15.5GB server', 'id' => 7 }
|
||||
]
|
||||
}
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -25,7 +25,20 @@ module Fog
|
|||
class Mock
|
||||
|
||||
def list_flavors_detail
|
||||
Fog::Mock.not_implemented
|
||||
response = Excon::Response.new
|
||||
response.status = 200
|
||||
response.body = {
|
||||
'flavors' => [
|
||||
{ 'name' => '256 server', 'id' => 1, 'ram' => 256, 'disk' => 10 },
|
||||
{ 'name' => '512 server', 'id' => 2, 'ram' => 512, 'disk' => 20 },
|
||||
{ 'name' => '1GB server', 'id' => 3, 'ram' => 1024, 'disk' => 40 },
|
||||
{ 'name' => '2GB server', 'id' => 4, 'ram' => 2048, 'disk' => 80 },
|
||||
{ 'name' => '4GB server', 'id' => 5, 'ram' => 4096, 'disk' => 160 },
|
||||
{ 'name' => '8GB server', 'id' => 6, 'ram' => 8192, 'disk' => 320 },
|
||||
{ 'name' => '15.5GB server', 'id' => 7, 'ram' => 15872, 'disk' => 620 }
|
||||
]
|
||||
}
|
||||
response
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue