1
0
Fork 0
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:
Trae Robrock 2013-07-12 07:22:08 -07:00
parent d81d000546
commit 8dee42d23b
7 changed files with 23 additions and 16 deletions

View file

@ -34,7 +34,7 @@ module Fog
},
{
"id" => 2676,
"name" => "Ubuntu 12.04 x64 Server",
"name" => "Ubuntu 12.04 x64",
"distribution" => "Ubuntu"
},

View file

@ -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

View file

@ -23,6 +23,8 @@ Shindo.tests('Fog::Compute[:digitalocean] | ssh_keys collection', ['digitalocean
end
end
key.destroy
end
end

View file

@ -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

View file

@ -10,6 +10,4 @@ Shindo.tests('Fog::Compute[:digitalocean] | destroy_server request', ['digitaloc
end
end
end

View file

@ -12,9 +12,12 @@ Shindo.tests('Fog::Compute[:digitalocean] | get_ssh_keys request', ['digitalocea
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

View file

@ -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