From 7304b5e600a992fb347b382e9d1b7c4206801e8d Mon Sep 17 00:00:00 2001 From: Ryan Richard Date: Fri, 30 Aug 2013 18:35:31 -0500 Subject: [PATCH] enable 2 failure tests, minor obfuscates --- lib/fog/rackspace/requests/monitoring/get_check.rb | 4 ++-- .../requests/monitoring/list_check_types.rb | 4 ++-- .../rackspace/requests/monitoring/list_checks.rb | 13 ++++++++++--- tests/rackspace/requests/monitoring/list_tests.rb | 3 --- 4 files changed, 14 insertions(+), 10 deletions(-) diff --git a/lib/fog/rackspace/requests/monitoring/get_check.rb b/lib/fog/rackspace/requests/monitoring/get_check.rb index 020788bc3..702a2b80a 100644 --- a/lib/fog/rackspace/requests/monitoring/get_check.rb +++ b/lib/fog/rackspace/requests/monitoring/get_check.rb @@ -22,7 +22,7 @@ module Fog response = Excon::Response.new response.status = 200 response.body = { - "id" => "mock_id", + "id" => check_id, "label" => nil, "type" => "remote.ping", "details" => {"count"=>5}, @@ -44,7 +44,7 @@ module Fog "X-RateLimit-Remaining" => "44676", "X-RateLimit-Window" => "24 hours", "X-RateLimit-Type" => "global", - "X-Response-Id" => ".rh-QScV.h-ord1-maas-prod-api0.r-uuWnOhLS.c-206541.ts-1377805994157.v-9c40430", + "X-Response-Id" => "jdnbono34090934nggn", "X-LB" => "ord1-maas-prod-api0", "Vary" => "Accept-Encoding", "Transfer-Encoding" => "chunked" diff --git a/lib/fog/rackspace/requests/monitoring/list_check_types.rb b/lib/fog/rackspace/requests/monitoring/list_check_types.rb index 943f421f9..cf1d3dbb7 100644 --- a/lib/fog/rackspace/requests/monitoring/list_check_types.rb +++ b/lib/fog/rackspace/requests/monitoring/list_check_types.rb @@ -75,12 +75,12 @@ module Fog "X-RateLimit-Remaining" => "49627", "X-RateLimit-Window" => "24 hours", "X-RateLimit-Type" => "global", - "X-Response-Id" =>" zsdvasdtrq345", + "X-Response-Id" => "zsdvasdtrq345", "X-LB" => "dfw1-maas-prod-api0", "Vary" => "Accept-Encoding", "Transfer-Encoding" => "chunked" } - response.remote_ip = "1.1.1.1" + response.remote_ip = Fog::Rackspace::MockData.ipv4_address response end end diff --git a/lib/fog/rackspace/requests/monitoring/list_checks.rb b/lib/fog/rackspace/requests/monitoring/list_checks.rb index dba041325..f3163effa 100644 --- a/lib/fog/rackspace/requests/monitoring/list_checks.rb +++ b/lib/fog/rackspace/requests/monitoring/list_checks.rb @@ -14,12 +14,19 @@ module Fog class Mock def list_checks(entity_id) + + check_id = Fog::Mock.random_letters(10) + + if entity_id == -1 + raise Fog::Rackspace::Monitoring::NotFound + end + response = Excon::Response.new response.status = 200 response.body = { "values" => [ { - "id" => "mock_id", + "id" => check_id, "label" => "load", "type" => "agent.load_average", "details" => {}, @@ -50,12 +57,12 @@ module Fog "X-RateLimit-Remaining" => "49627", "X-RateLimit-Window" => "24 hours", "X-RateLimit-Type" => "global", - "X-Response-Id" =>" j23jlk234jl2j34j", + "X-Response-Id" => "j23jlk234jl2j34j", "X-LB" => "dfw1-maas-prod-api0", "Vary" => "Accept-Encoding", "Transfer-Encoding" => "chunked" } - response.remote_ip = "1.1.1.1" + response.remote_ip = Fog::Rackspace::MockData.ipv4_address response end end diff --git a/tests/rackspace/requests/monitoring/list_tests.rb b/tests/rackspace/requests/monitoring/list_tests.rb index 7aebd7950..4d69426e5 100644 --- a/tests/rackspace/requests/monitoring/list_tests.rb +++ b/tests/rackspace/requests/monitoring/list_tests.rb @@ -45,11 +45,9 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_ end tests('failure') do tests('#fail to list checks').raises(Fog::Rackspace::Monitoring::NotFound) do - pending if Fog.mocking? account.list_checks(-1) end tests('#fail to list check types').raises(ArgumentError) do - pending if Fog.mocking? account.list_check_types(-1) end # This test has been put on hold due to a bug that incorrectly returns 200 OK to this request @@ -57,7 +55,6 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_ #account.list_metrics(-1,-1) #end tests('#fail: 1 argument instead of 0 for list_notification_plans').raises(ArgumentError) do - pending if Fog.mocking? account.list_notification_plans('fail') end tests('#fail to get list of data points').raises(Fog::Rackspace::Monitoring::BadRequest) do