mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
obfuscate all entity mocks
This commit is contained in:
parent
d64e084d16
commit
de66e72422
3 changed files with 20 additions and 13 deletions
|
@ -17,7 +17,10 @@ module Fog
|
|||
class Mock
|
||||
|
||||
def create_entity(options = {})
|
||||
|
||||
|
||||
account_id = Fog::Mock.random_numbers(6).to_s
|
||||
entity_id = Fog::Mock.random_letters(10)
|
||||
|
||||
if options[:label] == ""
|
||||
raise Fog::Rackspace::Monitoring::BadRequest
|
||||
end
|
||||
|
@ -27,8 +30,8 @@ module Fog
|
|||
response.body = ""
|
||||
response.headers = {
|
||||
"Date" => Time.now.utc.to_s,
|
||||
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/55555/entities/foobarbaz",
|
||||
"X-Object-ID" => "foobarbaz",
|
||||
"Location" => "https://monitoring.api.rackspacecloud.com/v1.0/" + account_id + "/entities/" + entity_id,
|
||||
"X-Object-ID" => entity_id,
|
||||
"X-RateLimit-Limit" => "50000",
|
||||
"X-RateLimit-Remaining" => "47877",
|
||||
"X-RateLimit-Window" => "24 hours",
|
||||
|
@ -38,7 +41,7 @@ module Fog
|
|||
"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
|
||||
|
|
|
@ -34,7 +34,7 @@ module Fog
|
|||
"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
|
||||
|
|
|
@ -17,6 +17,10 @@ module Fog
|
|||
|
||||
def get_entity(entity_id)
|
||||
|
||||
account_id = Fog::Mock.random_numbers(6).to_s
|
||||
server_id = Fog::Rackspace::MockData.uuid
|
||||
entity_label = Fog::Mock.random_letters(10)
|
||||
|
||||
if entity_id == -1
|
||||
raise Fog::Rackspace::Monitoring::NotFound
|
||||
end
|
||||
|
@ -25,17 +29,17 @@ module Fog
|
|||
response.status = 200
|
||||
response.body = {
|
||||
"id" => entity_id.to_s,
|
||||
"label" => "foolabel",
|
||||
"label" => entity_label,
|
||||
"ip_addresses" => {
|
||||
"access_ip0_v6" => "::1",
|
||||
"public0_v4" => "1.1.1.1",
|
||||
"public1_v6" => "::1",
|
||||
"access_ip1_v4" => "1.1.1.1",
|
||||
"private0_v4" => "10.10.10.1"
|
||||
},
|
||||
"access_ip0_v6" => Fog::Rackspace::MockData.ipv6_address,
|
||||
"public0_v4" => Fog::Rackspace::MockData.ipv4_address,
|
||||
"public1_v6" => Fog::Rackspace::MockData.ipv6_address,
|
||||
"access_ip1_v4" => Fog::Rackspace::MockData.ipv4_address,
|
||||
"private0_v4" => Fog::Rackspace::MockData.ipv4_address
|
||||
},
|
||||
"metadata" => nil,
|
||||
"managed" => false,
|
||||
"uri" => "https://ord.servers.api.rackspacecloud.com/55555/servers/27F99694-1775-4631-AFEA-0E1BA824ED86",
|
||||
"uri" => "https://ord.servers.api.rackspacecloud.com/" + account_id + "/servers/" + server_id,
|
||||
"agent_id" => nil,
|
||||
"created_at" => Time.now.to_i - 1,
|
||||
"updated_at" => Time.now.to_i
|
||||
|
|
Loading…
Add table
Reference in a new issue