mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Whitespace, fix tests for running in non mock mode, and clean up in non mock mode
This commit is contained in:
parent
d81d000546
commit
8dee42d23b
7 changed files with 23 additions and 16 deletions
|
@ -1,6 +1,6 @@
|
|||
module Fog
|
||||
module Compute
|
||||
class DigitalOcean
|
||||
class DigitalOcean
|
||||
class Real
|
||||
|
||||
def list_images(options = {})
|
||||
|
@ -23,18 +23,18 @@ module Fog
|
|||
"images" => [
|
||||
# Sample image
|
||||
{
|
||||
"id" => 1601,
|
||||
"name" => "CentOS 5.8 x64",
|
||||
"id" => 1601,
|
||||
"name" => "CentOS 5.8 x64",
|
||||
"distribution" => "CentOS"
|
||||
},
|
||||
{
|
||||
"id" => 1602,
|
||||
"name" => "CentOS 5.8 x32",
|
||||
"id" => 1602,
|
||||
"name" => "CentOS 5.8 x32",
|
||||
"distribution" => "CentOS"
|
||||
},
|
||||
{
|
||||
"id" => 2676,
|
||||
"name" => "Ubuntu 12.04 x64 Server",
|
||||
"name" => "Ubuntu 12.04 x64",
|
||||
"distribution" => "Ubuntu"
|
||||
},
|
||||
|
||||
|
|
|
@ -9,6 +9,7 @@ Shindo.tests("Fog::Compute[:digitalocean] | ssh_key model", ['digitalocean', 'co
|
|||
:ssh_pub_key => 'fookey'
|
||||
@key.is_a? Fog::Compute::DigitalOcean::SshKey
|
||||
end
|
||||
|
||||
tests('have the action') do
|
||||
test('reload') { @key.respond_to? 'reload' }
|
||||
%w{
|
||||
|
@ -18,18 +19,21 @@ Shindo.tests("Fog::Compute[:digitalocean] | ssh_key model", ['digitalocean', 'co
|
|||
test(action) { @key.respond_to? action }
|
||||
end
|
||||
end
|
||||
|
||||
tests('have attributes') do
|
||||
attributes = [
|
||||
:id,
|
||||
:name,
|
||||
:ssh_pub_key
|
||||
]
|
||||
|
||||
tests("The key model should respond to") do
|
||||
attributes.each do |attribute|
|
||||
test("#{attribute}") { @key.respond_to? attribute }
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
test('#destroy') do
|
||||
@key.destroy
|
||||
end
|
||||
|
|
|
@ -23,6 +23,8 @@ Shindo.tests('Fog::Compute[:digitalocean] | ssh_keys collection', ['digitalocean
|
|||
end
|
||||
end
|
||||
|
||||
key.destroy
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -5,7 +5,7 @@ Shindo.tests('Fog::Compute[:digitalocean] | create_server request', ['digitaloce
|
|||
'name' => String,
|
||||
'image_id' => Integer,
|
||||
'size_id' => Integer,
|
||||
'event_id' => Integer
|
||||
'event_id' => Integer
|
||||
}
|
||||
|
||||
service = Fog::Compute[:digitalocean]
|
||||
|
@ -13,7 +13,7 @@ Shindo.tests('Fog::Compute[:digitalocean] | create_server request', ['digitaloce
|
|||
tests('success') do
|
||||
|
||||
tests('#create_server').formats({'status' => 'OK', 'droplet' => @server_format}) do
|
||||
image = service.images.find { |img| img.name == 'Ubuntu 12.04 x64 Server' }
|
||||
image = service.images.find { |img| img.name == 'Ubuntu 12.04 x64' }
|
||||
flavor = service.flavors.find { |f| f.name == '512MB' }
|
||||
data = Fog::Compute[:digitalocean].create_server fog_server_name,
|
||||
flavor.id,
|
||||
|
@ -21,8 +21,5 @@ Shindo.tests('Fog::Compute[:digitalocean] | create_server request', ['digitaloce
|
|||
service.regions.first.id
|
||||
data.body
|
||||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -10,6 +10,4 @@ Shindo.tests('Fog::Compute[:digitalocean] | destroy_server request', ['digitaloc
|
|||
end
|
||||
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
|
|
|
@ -5,16 +5,19 @@ Shindo.tests('Fog::Compute[:digitalocean] | get_ssh_keys request', ['digitalocea
|
|||
'name' => String,
|
||||
'ssh_pub_key' => String,
|
||||
}
|
||||
|
||||
|
||||
service = Fog::Compute[:digitalocean]
|
||||
|
||||
tests('success') do
|
||||
|
||||
tests('#get_ssh_key') do
|
||||
key = service.create_ssh_key 'fookey', 'ssh-dss FOO'
|
||||
|
||||
tests('format').data_matches_schema(@ssh_key_format) do
|
||||
service.get_ssh_key(key.body['ssh_key']['id']).body['ssh_key']
|
||||
end
|
||||
|
||||
service.destroy_ssh_key(key.body['ssh_key']['id'])
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -7,15 +7,18 @@ Shindo.tests('Fog::Compute[:digitalocean] | list_ssh_keys request', ['digitaloce
|
|||
|
||||
tests('success') do
|
||||
|
||||
key = service.create_ssh_key 'fookey', 'ssh-dss FOO'
|
||||
|
||||
tests('#list_ssh_keys') do
|
||||
Fog::Compute[:digitalocean].create_ssh_key 'fookey', 'ssh-dss FOO'
|
||||
Fog::Compute[:digitalocean].list_ssh_keys.body['ssh_keys'].each do |key|
|
||||
service.list_ssh_keys.body['ssh_keys'].each do |key|
|
||||
tests('format').data_matches_schema(@ssh_key_format) do
|
||||
key
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
service.destroy_ssh_key(key.body['ssh_key']['id'])
|
||||
|
||||
end
|
||||
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue