1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00

Merge pull request #2308 from voodoo/master

added tests for monigtoring zones
This commit is contained in:
Kyle Rames 2013-10-30 07:32:06 -07:00
commit 7547ed6998
5 changed files with 109 additions and 0 deletions

View file

@ -98,6 +98,9 @@ module Fog
request :evaluate_alarm_example request :evaluate_alarm_example
request :list_monitoring_zones
request :get_monitoring_zone
class Mock < Fog::Rackspace::Service class Mock < Fog::Rackspace::Service

View file

@ -0,0 +1,15 @@
module Fog
module Rackspace
class Monitoring
class Real
def get_monitoring_zone by_id
request(
:expects => [200],
:method => 'GET',
:path => "monitoring_zones/#{by_id}"
)
end
end
end
end
end

View file

@ -0,0 +1,15 @@
module Fog
module Rackspace
class Monitoring
class Real
def list_monitoring_zones
request(
:expects => [200],
:method => 'GET',
:path => "monitoring_zones"
)
end
end
end
end
end

View file

@ -34,6 +34,70 @@ DELETE_DATA_FORMAT = {
:remote_ip => String :remote_ip => String
} }
LIST_MONITORING_ZONE = {
"values"=>
[{"id"=>String,
"label"=> Fog::Nullable::String,
"country_code"=> String,
"source_ips"=>[String, String]}],
"metadata"=>
{"count"=>Integer,
"limit"=>Integer,
"marker"=>Fog::Nullable::String,
"next_marker"=>Fog::Nullable::String,
"next_href"=>Fog::Nullable::String
}
}
GET_MONITORING_ZONE = {
"id" => String,
"label" => String,
"country_code" => String,
"source_ips" => [String]
}
# {"values"=>
# [{"id"=>"ch4GimHQsQ",
# "label"=>nil,
# "type"=>"remote.http",
# "details"=>
# {"url"=>"http://www.rackspace.com",
# "method"=>"GET",
# "follow_redirects"=>true,
# "include_body"=>false},
# "monitoring_zones_poll"=>["mzdfw"],
# "timeout"=>30,
# "period"=>100,
# "target_alias"=>nil,
# "target_hostname"=>"rackspace.com",
# "target_resolver"=>"IPv4",
# "disabled"=>false,
# "collectors"=>["coeT7x1iF3"],
# "metadata"=>nil,
# "created_at"=>1377803830760,
# "updated_at"=>1377803830760}],
# "metadata"=>
# {"count"=>1,
# "limit"=>100,
# "marker"=>nil,
# "next_marker"=>nil,
# "next_href"=>nil}}
# {"values"=>
# [{"id"=>String,
# "label"=>String,
# "country_code"=>String,
# "source_ips"=>[String, String]}],
# "metadata"=>
# {"count"=>Integer,
# "limit"=>Integer,
# "marker"=>nil,
# "next_marker"=>nil,
# "next_href"=>nil}}
CHECK_CREATE_OPTIONS = { CHECK_CREATE_OPTIONS = {
:details => { :details => {
:url => 'http://www.rackspace.com', :url => 'http://www.rackspace.com',

View file

@ -15,6 +15,18 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_
sleep(SLEEP_TIME) unless Fog.mocking? sleep(SLEEP_TIME) unless Fog.mocking?
tests('success') do tests('success') do
tests('#get list of monitoring zones').formats(LIST_MONITORING_ZONE) do
pending if Fog.mocking?
account.list_monitoring_zones.body
end
tests('#get a monitoring zone').formats(GET_MONITORING_ZONE) do
pending if Fog.mocking?
account.get_monitoring_zone('mzdfw').body
end
tests('#get list of checks').formats(LIST_HEADERS_FORMAT) do tests('#get list of checks').formats(LIST_HEADERS_FORMAT) do
account.list_checks(entity_id).data[:headers] account.list_checks(entity_id).data[:headers]
end end