diff --git a/lib/fog/digitalocean/requests/compute/list_images.rb b/lib/fog/digitalocean/requests/compute/list_images.rb index e79a9567e..771e88628 100644 --- a/lib/fog/digitalocean/requests/compute/list_images.rb +++ b/lib/fog/digitalocean/requests/compute/list_images.rb @@ -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" }, diff --git a/tests/digitalocean/models/compute/ssh_key_tests.rb b/tests/digitalocean/models/compute/ssh_key_tests.rb index 531774ad6..c2753f596 100644 --- a/tests/digitalocean/models/compute/ssh_key_tests.rb +++ b/tests/digitalocean/models/compute/ssh_key_tests.rb @@ -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 diff --git a/tests/digitalocean/models/compute/ssh_keys_tests.rb b/tests/digitalocean/models/compute/ssh_keys_tests.rb index 10f64f12a..b6674173f 100644 --- a/tests/digitalocean/models/compute/ssh_keys_tests.rb +++ b/tests/digitalocean/models/compute/ssh_keys_tests.rb @@ -23,6 +23,8 @@ Shindo.tests('Fog::Compute[:digitalocean] | ssh_keys collection', ['digitalocean end end + key.destroy + end end diff --git a/tests/digitalocean/requests/compute/create_server_tests.rb b/tests/digitalocean/requests/compute/create_server_tests.rb index 024da5c38..624cb5e1b 100644 --- a/tests/digitalocean/requests/compute/create_server_tests.rb +++ b/tests/digitalocean/requests/compute/create_server_tests.rb @@ -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 diff --git a/tests/digitalocean/requests/compute/destroy_server_tests.rb b/tests/digitalocean/requests/compute/destroy_server_tests.rb index b1cc72359..d1c312064 100644 --- a/tests/digitalocean/requests/compute/destroy_server_tests.rb +++ b/tests/digitalocean/requests/compute/destroy_server_tests.rb @@ -10,6 +10,4 @@ Shindo.tests('Fog::Compute[:digitalocean] | destroy_server request', ['digitaloc end end - - end diff --git a/tests/digitalocean/requests/compute/get_ssh_key_tests.rb b/tests/digitalocean/requests/compute/get_ssh_key_tests.rb index 88fff114f..56c5c3116 100644 --- a/tests/digitalocean/requests/compute/get_ssh_key_tests.rb +++ b/tests/digitalocean/requests/compute/get_ssh_key_tests.rb @@ -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 diff --git a/tests/digitalocean/requests/compute/list_ssh_keys_tests.rb b/tests/digitalocean/requests/compute/list_ssh_keys_tests.rb index db1595bb2..4d7ce9f3a 100644 --- a/tests/digitalocean/requests/compute/list_ssh_keys_tests.rb +++ b/tests/digitalocean/requests/compute/list_ssh_keys_tests.rb @@ -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