mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
list_data_points mock support
This commit is contained in:
parent
da9b2e381b
commit
f805662213
3 changed files with 31 additions and 3 deletions
|
@ -30,7 +30,7 @@ module Fog
|
||||||
"X-RateLimit-Remaining" => "49627",
|
"X-RateLimit-Remaining" => "49627",
|
||||||
"X-RateLimit-Window" => "24 hours",
|
"X-RateLimit-Window" => "24 hours",
|
||||||
"X-RateLimit-Type" => "global",
|
"X-RateLimit-Type" => "global",
|
||||||
"X-Response-Id" => ".rh-lHJL.h-ord1-maas-prod-api1.r-AGRIH406.c-4085336.ts-1377785008661.v-e602877",
|
"X-Response-Id" => "lsknvnslnv2083ovnsdbno00",
|
||||||
"X-LB" => "ord1-maas-prod-api1",
|
"X-LB" => "ord1-maas-prod-api1",
|
||||||
"Content-Length" => "0",
|
"Content-Length" => "0",
|
||||||
"Content-Type" => "text/plain",
|
"Content-Type" => "text/plain",
|
||||||
|
|
|
@ -18,6 +18,36 @@ module Fog
|
||||||
|
|
||||||
def list_data_points(entity_id, check_id, metric_name, options)
|
def list_data_points(entity_id, check_id, metric_name, options)
|
||||||
|
|
||||||
|
if entity_id == -1 || check_id == -1 || metric_name == -1 || options == -1
|
||||||
|
raise Fog::Rackspace::Monitoring::BadRequest
|
||||||
|
end
|
||||||
|
|
||||||
|
response = Excon::Response.new
|
||||||
|
response.status = 200
|
||||||
|
response.body = {
|
||||||
|
"values" => [],
|
||||||
|
"metadata"=> {
|
||||||
|
"count" =>0,
|
||||||
|
"limit" =>nil,
|
||||||
|
"marker" =>nil,
|
||||||
|
"next_marker" =>nil,
|
||||||
|
"next_href" =>nil
|
||||||
|
}
|
||||||
|
}
|
||||||
|
response.headers = {
|
||||||
|
"Date" => Time.now.utc.to_s,
|
||||||
|
"X-RateLimit-Limit" => "50000",
|
||||||
|
"X-RateLimit-Remaining" => "49627",
|
||||||
|
"X-RateLimit-Window" => "24 hours",
|
||||||
|
"X-RateLimit-Type" => "global",
|
||||||
|
"X-Response-Id" => "slknbnsodb9830unvnve",
|
||||||
|
"X-LB" => "ord1-maas-prod-api1",
|
||||||
|
"Content-Type" => "application/json; charset=UTF-8",
|
||||||
|
"Vary" => "Accept-Encoding",
|
||||||
|
"Transfer-Encoding" => "chunked"
|
||||||
|
}
|
||||||
|
response.remote_ip = Fog::Rackspace::MockData.ipv4_address
|
||||||
|
response
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
@ -34,7 +34,6 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_
|
||||||
account.list_notification_plans().data[:headers]
|
account.list_notification_plans().data[:headers]
|
||||||
end
|
end
|
||||||
tests('#get list of data points').formats(LIST_HEADERS_FORMAT) do
|
tests('#get list of data points').formats(LIST_HEADERS_FORMAT) do
|
||||||
pending if Fog.mocking?
|
|
||||||
options = {
|
options = {
|
||||||
:points => 1,
|
:points => 1,
|
||||||
:from => now,
|
:from => now,
|
||||||
|
@ -58,7 +57,6 @@ Shindo.tests('Fog::Rackspace::Monitoring | list_tests', ['rackspace','rackspace_
|
||||||
account.list_notification_plans('fail')
|
account.list_notification_plans('fail')
|
||||||
end
|
end
|
||||||
tests('#fail to get list of data points').raises(Fog::Rackspace::Monitoring::BadRequest) do
|
tests('#fail to get list of data points').raises(Fog::Rackspace::Monitoring::BadRequest) do
|
||||||
pending if Fog.mocking?
|
|
||||||
account.list_data_points(-1,-1,-1,-1).data
|
account.list_data_points(-1,-1,-1,-1).data
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue