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

one last obfuscate pass

This commit is contained in:
Ryan Richard 2013-09-02 22:33:46 -05:00
parent f805662213
commit 96517d10de
5 changed files with 29 additions and 15 deletions

View file

@ -16,6 +16,9 @@ module Fog
class Mock
def create_agent_token(options = {})
account_id = Fog::Mock.random_numbers(6).to_s
token = Fog::Mock.random_letters(50).to_s
if options == -1
raise TypeError
@ -26,18 +29,18 @@ module Fog
response.body = ""
response.headers = {
"Date" => Time.now.utc.to_s,
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/55555/agent_tokens/7e261310b36834a9969e389c8e90adc08629c00d4c74aaea5e42599cc07ba80d.55555",
"X-Object-ID" => "7e261310b36834a9969e389c8e90adc08629c00d4c74aaea5e42599cc07ba80d.55555",
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/" + account_id + "/agent_tokens/" + token,
"X-Object-ID" => token,
"X-RateLimit-Limit" => "50000",
"X-RateLimit-Remaining" => "49627",
"X-RateLimit-Window" => "24 hours",
"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" => "oknwowevown9330wneviniv",
"X-LB" => "ord1-maas-prod-api1",
"Content-Length" => "0",
"Content-Type" => "text/plain",
}
response.remote_ip = "1.1.1.1"
response.remote_ip = Fog::Rackspace::MockData.ipv4_address
response
end
end

View file

@ -16,6 +16,9 @@ module Fog
class Mock
def create_check(entity_id, options = {})
account_id = Fog::Mock.random_numbers(6).to_s
mock_id = Fog::Mock.random_letters(10).to_s
if options[:type] == ""
raise Fog::Rackspace::Monitoring::BadRequest
@ -26,18 +29,18 @@ module Fog
response.body = ""
response.headers = {
"Date" => Time.now.utc.to_s,
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/55555/" + entity_id + "/checks/mock_id",
"X-Object-ID" => "mock_id",
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/" + account_id + "/" + entity_id + "/checks/" + mock_id,
"X-Object-ID" => mock_id,
"X-RateLimit-Limit" => "50000",
"X-RateLimit-Remaining" => "49627",
"X-RateLimit-Window" => "24 hours",
"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" => "knvlknvosnd20038hgouwvn9nv",
"X-LB" => "ord1-maas-prod-api1",
"Content-Length" => "0",
"Content-Type" => "text/plain",
}
response.remote_ip = "1.1.1.1"
response.remote_ip = Fog::Rackspace::MockData.ipv4_address
response
end
end

View file

@ -15,6 +15,9 @@ module Fog
class Mock
def delete_agent_token(options = {})
account_id = Fog::Mock.random_numbers(6).to_s
token = Fog::Mock.random_letters(50).to_s
if options == -1
raise Fog::Rackspace::Monitoring::NotFound
end
@ -24,8 +27,8 @@ module Fog
response.body = ""
response.headers = {
"Date" => Time.now.utc.to_s,
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/55555/agent_tokens/7e261310b36834a9969e389c8e90adc08629c00d4c74aaea5e42599cc07ba80d.55555",
"X-Object-ID" => "7e261310b36834a9969e389c8e90adc08629c00d4c74aaea5e42599cc07ba80d.55555",
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/" + account_id + "/agent_tokens/" + token,
"X-Object-ID" => token,
"X-RateLimit-Limit" => "50000",
"X-RateLimit-Remaining" => "49627",
"X-RateLimit-Window" => "24 hours",

View file

@ -15,6 +15,8 @@ module Fog
class Mock
def get_agent_token(id)
token = Fog::Mock.random_letters(50).to_s
if id == -1
raise TypeError
end
@ -22,8 +24,8 @@ module Fog
response = Excon::Response.new
response.status = 200
response.body = {
"id" => "7e261310b36834a9969e389c8e90adc08629c00d4c74aaea5e42599cc07ba80d.55555",
"token" => "7e261310b36834a9969e389c8e90adc08629c00d4c74aaea5e42599cc07ba80d.55555",
"id" => token,
"token" => token,
"label" => "mock_token"
}
response.headers = {
@ -33,7 +35,7 @@ module Fog
"X-RateLimit-Remaining" => "47903",
"X-RateLimit-Window" => "24 hours",
"X-RateLimit-Type" => "global",
"X-Response-Id" => ".rh-lHJL.h-ord1-maas-prod-api1.r-5YqHhQwV.c-6259794.ts-1377798031450.v-e602877",
"X-Response-Id" => "kvnsdonvosnv92989vbvbob",
"X-LB" => "ord1-maas-prod-api0",
"Vary" => "Accept-Encoding",
"Transfer-Encoding" => "chunked"

View file

@ -14,14 +14,17 @@ module Fog
end
class Mock
def list_agent_tokens(options={})
token = Fog::Mock.random_letters(50).to_s
response = Excon::Response.new
response.status = 200
response.body = {
"values"=> [
{
"id" => "7e261310b36834a9969e389c8e90adc08629c00d4c74aaea5e42599cc07ba80d.55555",
"token" => "7e261310b36834a9969e389c8e90adc08629c00d4c74aaea5e42599cc07ba80d.55555",
"id" => token,
"token" => token,
"label" => "mock_token"
}
],