mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Hardcode some responses to tests
This commit is contained in:
parent
cb95e27c8a
commit
84a592104b
2 changed files with 22 additions and 9 deletions
|
@ -5,14 +5,20 @@ def service
|
||||||
end
|
end
|
||||||
|
|
||||||
def fog_test_server_attributes
|
def fog_test_server_attributes
|
||||||
|
|
||||||
|
# Hard coding numbers because requests from tests are sometimes failing.
|
||||||
|
# TODO: Mock properly instead
|
||||||
image = service.images.find { |i| i.name == 'Ubuntu 13.10 x64' }
|
image = service.images.find { |i| i.name == 'Ubuntu 13.10 x64' }
|
||||||
|
image_id = image.nil? ? 1505447 : image.id
|
||||||
region = service.regions.find { |r| r.name == 'New York 1' }
|
region = service.regions.find { |r| r.name == 'New York 1' }
|
||||||
|
region_id = region.nil? ? 4 : region.id
|
||||||
flavor = service.flavors.find { |r| r.name == '512MB' }
|
flavor = service.flavors.find { |r| r.name == '512MB' }
|
||||||
|
flavor_id = flavor.nil? ? 66 : flavor.id
|
||||||
|
|
||||||
{
|
{
|
||||||
:image_id => image.id,
|
:image_id => image_id,
|
||||||
:region_id => region.id,
|
:region_id => region_id,
|
||||||
:flavor_id => flavor.id
|
:flavor_id => flavor_id
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -13,12 +13,19 @@ Shindo.tests('Fog::Compute[:digitalocean] | create_server request', ['digitaloce
|
||||||
tests('success') do
|
tests('success') do
|
||||||
|
|
||||||
tests('#create_server').formats({'status' => 'OK', 'droplet' => @server_format}) do
|
tests('#create_server').formats({'status' => 'OK', 'droplet' => @server_format}) do
|
||||||
image = service.images.find { |img| img.name == 'Ubuntu 13.10 x64' }
|
image = service.images.find { |i| i.name == 'Ubuntu 13.10 x64' }
|
||||||
flavor = service.flavors.find { |f| f.name == '512MB' }
|
image_id = image.nil? ? 1505447 : image.id
|
||||||
data = Fog::Compute[:digitalocean].create_server fog_server_name,
|
region = service.regions.find { |r| r.name == 'New York 1' }
|
||||||
flavor.id,
|
region_id = region.nil? ? 4 : region.id
|
||||||
image.id,
|
flavor = service.flavors.find { |r| r.name == '512MB' }
|
||||||
service.regions.first.id
|
flavor_id = flavor.nil? ? 66 : flavor.id
|
||||||
|
|
||||||
|
data = Fog::Compute[:digitalocean].create_server(
|
||||||
|
fog_server_name,
|
||||||
|
flavor_id,
|
||||||
|
image_id,
|
||||||
|
region_id
|
||||||
|
)
|
||||||
data.body
|
data.body
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue