1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/rackspace/requests/monitoring/agent_tests.rb
2013-07-24 10:50:27 -07:00

34 lines
1.2 KiB
Ruby

Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace_monitoring']) do
pending if Fog.mocking?
account = Fog::Rackspace::Monitoring.new
agent_token = nil
options = { "label" => "Bar" }
tests('success') do
tests('#create new agent token').formats(DATA_FORMAT) do
response = account.create_agent_token(options).data
agent_token = response[:headers]["X-Object-ID"]
response
end
tests('#list agent tokens').formats(LIST_HEADERS_FORMAT) do
account.list_agent_tokens().data[:headers]
end
tests('#get agent token').formats(LIST_HEADERS_FORMAT) do
account.get_agent_token(agent_token).data[:headers]
end
tests('#delete agent token').formats(DELETE_HEADERS_FORMAT) do
account.delete_agent_token(agent_token).data[:headers]
end
end
tests('failure') do
tests('#fail to create agent token(-1)').raises(TypeError) do
account.create_agent_token(-1)
end
tests('#fail to get agent token(-1)').raises(TypeError) do
account.create_agent_token(-1)
end
tests('#fail to delete agent token(-1)').raises(Fog::Rackspace::Monitoring::NotFound) do
account.delete_agent_token(-1)
end
end
end