From 6f1b9a3688f4ae4797c0e1ae29a021a57bbecbf0 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Lindstro=CC=88m?= Date: Tue, 29 Nov 2011 19:00:45 +0100 Subject: [PATCH] [glesys|compute] fix test formats and whitespaces --- tests/glesys/requests/compute/helper.rb | 151 ++++++++++-------- tests/glesys/requests/compute/ip_tests.rb | 2 +- tests/glesys/requests/compute/server_tests.rb | 8 +- 3 files changed, 92 insertions(+), 69 deletions(-) diff --git a/tests/glesys/requests/compute/helper.rb b/tests/glesys/requests/compute/helper.rb index f6aacbd34..5d67e29d6 100644 --- a/tests/glesys/requests/compute/helper.rb +++ b/tests/glesys/requests/compute/helper.rb @@ -4,7 +4,9 @@ class Glesys module Servers LIST = { - 'arguments' => [], + 'debug' => { + 'input' => [] + }, 'servers' => [{ 'serverid' => String, 'hostname' => String, @@ -18,17 +20,19 @@ class Glesys } CREATE = { - 'arguments' => { - "rootpw" => String, - "disksize" => String, - "memorysize" => String, - "datacenter" => String, - "cpucores" => String, - "transfer" => String, - "template" => String, - "description" => String, - "hostname" => String, - "platform" => String + 'debug' => { + 'input' => { + "rootpw" => String, + "disksize" => String, + "memorysize" => String, + "datacenter" => String, + "cpucores" => String, + "transfer" => String, + "template" => String, + "description" => String, + "hostname" => String, + "platform" => String + } }, 'server' => { 'serverid' => String, @@ -46,9 +50,11 @@ class Glesys } DESTROY = { - 'arguments' => { - 'serverid' => String, - 'keepip' => String, + 'debug' => { + 'input' => { + 'serverid' => String, + 'keepip' => String, + } }, 'status' => { 'code' => String, @@ -57,61 +63,68 @@ class Glesys } DETAILS = { - 'arguments' => { - 'serverid' => String - }, + 'debug' => { + 'input' => { + 'serverid' => String + } + }, 'server' => { 'managedhosting' => String, 'cost' => { 'amount' => Float, - 'timeperiod' => String, + 'timeperiod' => String, 'currency' => String }, - 'datacenter' => String, + 'serverid' => String, + 'datacenter' => String, 'memory' => String, - 'cpucores' => String, - 'transfer' => String, - 'template' => String, + 'cpucores' => String, + 'transfer' => String, + 'template' => String, 'iplist' => [{ - 'cost' => String, - 'version' => String, + 'cost' => String, + 'version' => String, 'ip' => String }], 'description' => String, - 'hostname' => String, - 'disk' => String, + 'hostname' => String, + 'disk' => String, 'platform' => String - }, + }, 'status' => { - 'code' => String, + 'code' => String, 'text' => String } } STATUS = { - 'arguments' => { - 'serverid' => String - }, + 'debug' => { + 'input' => { + 'serverid' => String + } + }, 'server' => { - 'memory' => String, + 'memory' => String, 'bandwidth' => { - 'last30days' => Integer, + 'last30days' => Integer, 'today' => Integer, 'max' => String - }, - 'cpu' => String, - 'disk' => String, + }, + 'cpu' => String, + 'disk' => String, 'state' => String - }, - 'status' => { + }, + 'status' => { 'code' => String, 'text' => String } } - + START = { - 'arguments' => { - 'serverid' => String + 'debug' => { + 'input' => { + 'serverid' => String + } }, 'status' => { 'code' => String, @@ -120,9 +133,11 @@ class Glesys } STOP = { - 'arguments' => { - 'serverid' => String, - 'type' => String + 'debug' => { + 'input' => { + 'serverid' => String, + 'type' => String + } }, 'status' => { 'code' => String, @@ -132,9 +147,11 @@ class Glesys end module Ips - + IPLIST = { - 'arguments' => [], + 'debug' => { + 'input' => [] + }, 'iplist' => [{ 'price' => { 'amount' => String, @@ -153,12 +170,14 @@ class Glesys 'text' => String } } - + IPLIST_ALL = { - 'arguments' => { - 'datacenter' => String, - 'ipversion' => String, - 'platform' => String + 'debug' => { + 'input' => { + 'datacenter' => String, + 'ipversion' => String, + 'platform' => String + } }, 'iplist' => [], 'status' => { @@ -173,11 +192,13 @@ class Glesys } IPLIST_CATCH_RELEASE = { - 'arguments' => { - 'ipaddress' => String, - }, + 'debug' => { + 'input' => { + 'ipaddress' => String, + } + }, 'status' => { - 'code' => String, + 'code' => String, 'text' => String } } @@ -186,20 +207,22 @@ class Glesys module Templates LIST = { - 'arguments' => [], - 'templates' => { + 'debug' => { + 'input' => [] + }, + 'templates' => { 'Xen' => [{ 'name' => String, - 'os' => String, - 'min_mem_size' => String, - 'min_disk_size' => String, + 'os' => String, + 'min_mem_size' => String, + 'min_disk_size' => String, 'platform' => String }], 'OpenVZ' => [{ 'name' => String, - 'os' => String, - 'min_mem_size' => String, - 'min_disk_size' => String, + 'os' => String, + 'min_mem_size' => String, + 'min_disk_size' => String, 'platform' => String }] }, diff --git a/tests/glesys/requests/compute/ip_tests.rb b/tests/glesys/requests/compute/ip_tests.rb index 08f55272f..88b54508e 100644 --- a/tests/glesys/requests/compute/ip_tests.rb +++ b/tests/glesys/requests/compute/ip_tests.rb @@ -10,7 +10,7 @@ Shindo.tests('Fog::Compute[:glesys] | ip requests', ['glesys']) do Fog::Compute[:glesys].ip_list_own.body['response'] end - tests("#ip_list_free(:datcenter => 'Falkenberg, :platform => 'Xen', :ipversion => 4)" + tests("#ip_list_free(:datacenter => 'Falkenberg, :platform => 'Xen', :ipversion => 4)" ).formats(Glesys::Compute::Formats::Ips::IPLIST_ALL) do pending if Fog.mocking? ips = Fog::Compute[:glesys].ip_list_free( diff --git a/tests/glesys/requests/compute/server_tests.rb b/tests/glesys/requests/compute/server_tests.rb index f41c238c9..153a53948 100644 --- a/tests/glesys/requests/compute/server_tests.rb +++ b/tests/glesys/requests/compute/server_tests.rb @@ -1,5 +1,5 @@ Shindo.tests('Fog::Compute[:glesys] | server requests', ['glesys']) do - + @serverid = nil @hostname = "fog-#{Time.now.to_i}" @@ -27,7 +27,7 @@ Shindo.tests('Fog::Compute[:glesys] | server requests', ['glesys']) do :cpucores => "1", :transfer => "500" ) - + @serverid = vm.body['response']['server']['serverid'] vm.body['response'] end @@ -35,7 +35,7 @@ Shindo.tests('Fog::Compute[:glesys] | server requests', ['glesys']) do unless Fog.mocking? Fog::Compute[:glesys].servers.get(@serverid).wait_for { ready? } end - + tests("#server_details(#{@serverid})").formats(Glesys::Compute::Formats::Servers::DETAILS) do pending if Fog.mocking? Fog::Compute[:glesys].server_details(@serverid).body['response'] @@ -55,7 +55,7 @@ Shindo.tests('Fog::Compute[:glesys] | server requests', ['glesys']) do unless Fog.mocking? pending if Fog.mocking? s = Fog::Compute[:glesys].servers.get(@serverid) - s.wait_for { s.state == 'stopped' } + s.wait_for { s.state == 'stopped' } end tests("#start(:serverid => #{@serverid})").formats(Glesys::Compute::Formats::Servers::START) do