2013-01-29 15:25:06 -05:00
|
|
|
Shindo.tests('Fog::Compute[:digitalocean] | create_server request', ['digitalocean', 'compute']) do
|
|
|
|
|
2013-02-26 13:27:07 -05:00
|
|
|
@server_format = {
|
|
|
|
'id' => Integer,
|
|
|
|
'name' => String,
|
|
|
|
'image_id' => Integer,
|
|
|
|
'size_id' => Integer,
|
2013-07-12 10:22:08 -04:00
|
|
|
'event_id' => Integer
|
2013-02-26 13:27:07 -05:00
|
|
|
}
|
|
|
|
|
2013-01-29 15:25:06 -05:00
|
|
|
service = Fog::Compute[:digitalocean]
|
|
|
|
|
|
|
|
tests('success') do
|
|
|
|
|
2013-02-26 13:27:07 -05:00
|
|
|
tests('#create_server').formats({'status' => 'OK', 'droplet' => @server_format}) do
|
2013-12-30 02:38:04 -05:00
|
|
|
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_id = region.nil? ? 4 : region.id
|
|
|
|
flavor = service.flavors.find { |r| r.name == '512MB' }
|
|
|
|
flavor_id = flavor.nil? ? 66 : flavor.id
|
|
|
|
|
|
|
|
data = Fog::Compute[:digitalocean].create_server(
|
|
|
|
fog_server_name,
|
|
|
|
flavor_id,
|
|
|
|
image_id,
|
|
|
|
region_id
|
|
|
|
)
|
2013-02-26 13:27:07 -05:00
|
|
|
data.body
|
2013-01-29 15:25:06 -05:00
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|