From 5c0743bfa8f88150bbcdd357e188bffa2c40faff Mon Sep 17 00:00:00 2001 From: Kyle Rames Date: Thu, 15 Aug 2013 13:09:06 -0500 Subject: [PATCH] [rackspace] fixing broken tests --- lib/fog/rackspace/compute.rb | 4 ++++ .../requests/compute_v2/server_tests.rb | 6 +++++- .../requests/storage/large_object_tests.rb | 16 ++++++++++++---- 3 files changed, 21 insertions(+), 5 deletions(-) diff --git a/lib/fog/rackspace/compute.rb b/lib/fog/rackspace/compute.rb index 7d1ff92ef..b8ee75c5b 100644 --- a/lib/fog/rackspace/compute.rb +++ b/lib/fog/rackspace/compute.rb @@ -6,6 +6,10 @@ module Fog class Rackspace < Fog::Service include Fog::Rackspace::Errors + class ServiceError < Fog::Rackspace::Errors::ServiceError; end + class InternalServerError < Fog::Rackspace::Errors::InternalServerError; end + class BadRequest < Fog::Rackspace::Errors::BadRequest; end + requires :rackspace_api_key, :rackspace_username recognizes :rackspace_auth_url, :rackspace_servicenet, :persistent recognizes :rackspace_auth_token, :rackspace_management_url, :rackspace_compute_v1_url, :rackspace_region diff --git a/tests/rackspace/requests/compute_v2/server_tests.rb b/tests/rackspace/requests/compute_v2/server_tests.rb index 6af4e6a9b..bf1c943d8 100644 --- a/tests/rackspace/requests/compute_v2/server_tests.rb +++ b/tests/rackspace/requests/compute_v2/server_tests.rb @@ -106,7 +106,11 @@ Shindo.tests('Fog::Compute::RackspaceV2 | server_tests', ['rackspace']) do sleep 120 unless Fog.mocking? tests('#resize_server').succeeds do - resize_flavor_id = flavor_id + if Fog.mocking? + resize_flavor_id = flavor_id + else + resize_flavor_id = service.flavors[1] + end service.resize_server(server_id, resize_flavor_id) end wait_for_server_state(service, server_id, 'VERIFY_RESIZE', 'ACTIVE') diff --git a/tests/rackspace/requests/storage/large_object_tests.rb b/tests/rackspace/requests/storage/large_object_tests.rb index 3131e358b..e8de08b6f 100644 --- a/tests/rackspace/requests/storage/large_object_tests.rb +++ b/tests/rackspace/requests/storage/large_object_tests.rb @@ -304,12 +304,20 @@ Shindo.tests('Fog::Storage[:rackspace] | large object requests', ['rackspace']) end end - tests('#delete_static_large_object with missing container').raises(Fog::Storage::Rackspace::NotFound) do - Fog::Storage[:rackspace].delete_static_large_object('fognoncontainer', 'fog_large_object') + tests('#delete_static_large_object with missing container') do + response = Fog::Storage[:rackspace].delete_static_large_object('fognoncontainer', 'fog_large_object') + returns(200) { response.status } + returns(0) { response.body["Number Not Found"] } + returns("400 Bad Request") { response.body["Response Status"]} + returns("Invalid bulk delete.") { response.body["Response Body"]} end - tests('#delete_static_large_object with missing manifest').raises(Fog::Storage::Rackspace::NotFound) do - Fog::Storage[:rackspace].delete_static_large_object(@directory.identity, 'fog_non_object') + tests('#delete_static_large_object with missing manifest') do + response = Fog::Storage[:rackspace].delete_static_large_object(@directory.identity, 'fog_non_object') + returns(200) { response.status } + returns(0) { response.body["Number Not Found"] } + returns("400 Bad Request") { response.body["Response Status"]} + returns("Invalid bulk delete.") { response.body["Response Body"]} end tests('#delete_static_large_object with missing segment') do