Created
December 11, 2013 22:27
-
-
Save krames/7919623 to your computer and use it in GitHub Desktop.
This example illustrates adding a 'get_cpus_info' test to tests/rackspace/requests/monitoring/agent_tests.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Shindo.tests('Fog::Rackspace::Monitoring | agent_tests', ['rackspace','rackspace_monitoring']) do | |
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 | |
tests('get_cpus_info').returns(200) do | |
response = account.get_cpus_info(12) | |
response.status | |
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1.9.3@fog_dev:fog [pr_2442*]$ FOG_MOCK=true bundle exec shindo tests/rackspace/requests/monitoring/agent_tests.rb | |
[fog][WARNING] Unsupported StormOnDemand service: network | |
[fog][WARNING] Unsupported StormOnDemand service: storage | |
[fog][WARNING] Unsupported StormOnDemand service: dns | |
[fog][WARNING] Unsupported StormOnDemand service: billing | |
[fog][WARNING] Unsupported StormOnDemand service: monitoring | |
[fog][WARNING] Unsupported StormOnDemand service: support | |
[fog][WARNING] Unsupported StormOnDemand service: account | |
[fog][WARNING] Unsupported StormOnDemand service: vpn | |
Skipping tests for dreamhost due to lacking credentials (add some to '/Users/kyle.rames/Projects/fog/tests/.fog' to run them) | |
Skipping tests for ecloud due to lacking credentials (add some to '/Users/kyle.rames/Projects/fog/tests/.fog' to run them) | |
Skipping tests for serverlove due to lacking credentials (add some to '/Users/kyle.rames/Projects/fog/tests/.fog' to run them) | |
Skipping tests for stormondemand due to lacking credentials (add some to '/Users/kyle.rames/Projects/fog/tests/.fog' to run them) | |
Skipping tests for xenserver due to lacking credentials (add some to '/Users/kyle.rames/Projects/fog/tests/.fog' to run them) | |
Skipping tests for libvirt due to missing `ruby-libvirt` gem. | |
Fog::Rackspace::Monitoring | agent_tests (rackspace, rackspace_monitoring) | |
success | |
#create new agent token + has proper format | |
#list agent tokens + has proper format | |
#get agent token + has proper format | |
#delete agent token + has proper format | |
get_cpus_info + returns 200 | |
failure | |
#fail to create agent token(-1) + raises TypeError | |
#fail to get agent token(-1) + raises TypeError | |
#fail to delete agent token(-1) + raises Fog::Rackspace::Monitoring::NotFound | |
8 succeeded in 1.158237 seconds | |
1.9.3@fog_dev:fog [pr_2442*]$ | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment