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

[Brightbox] Switches to new format helper

Using #data_matches_schema which correctly fails when a nullable
resource is absent.
This commit is contained in:
Paul Thornthwaite 2013-01-23 15:08:24 +00:00 committed by Paul Thornthwaite
parent 4c9f4cf671
commit 4e41e00fed
14 changed files with 72 additions and 72 deletions

View file

@ -5,21 +5,21 @@ Shindo.tests('Fog::Compute[:brightbox] | account requests', ['brightbox']) do
tests("#list_accounts") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_accounts
formats(Brightbox::Compute::Formats::Collection::ACCOUNTS, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::ACCOUNTS, {:allow_extra_keys => true}) { result }
end
tests("#get_scoped_account") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_scoped_account
@scoped_account_identifier = result["id"]
formats(Brightbox::Compute::Formats::Full::ACCOUNT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
test("ftp password is blanked") { result["library_ftp_password"].nil? }
end
tests("#get_account(#{@scoped_account_identifier}") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_account(@scoped_account_identifier)
formats(Brightbox::Compute::Formats::Full::ACCOUNT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
test("ftp password is blanked") { result["library_ftp_password"].nil? }
end
@ -27,26 +27,26 @@ Shindo.tests('Fog::Compute[:brightbox] | account requests', ['brightbox']) do
tests("#update_scoped_account(#{update_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].update_scoped_account(update_options)
formats(Brightbox::Compute::Formats::Full::ACCOUNT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
end
tests("#update_account(#{@scoped_account_identifier}, #{update_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].update_account(@scoped_account_identifier, update_options)
formats(Brightbox::Compute::Formats::Full::ACCOUNT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
end
tests("#reset_ftp_password_scoped_account") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].reset_ftp_password_scoped_account
formats(Brightbox::Compute::Formats::Full::ACCOUNT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
test("new ftp password is visible") { ! result["library_ftp_password"].nil? }
end
tests("#reset_ftp_password_account(#{@scoped_account_identifier})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].reset_ftp_password_account(@scoped_account_identifier)
formats(Brightbox::Compute::Formats::Full::ACCOUNT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::ACCOUNT, {:allow_extra_keys => true}) { result }
test("new ftp password is visible") { ! result["library_ftp_password"].nil? }
end

View file

@ -11,39 +11,39 @@ Shindo.tests('Fog::Compute[:brightbox] | api client requests', ['brightbox']) do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].create_api_client(create_options)
@api_client_id = result["id"]
formats(Brightbox::Compute::Formats::Full::API_CLIENT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::API_CLIENT, {:allow_extra_keys => true}) { result }
end
tests("#list_api_clients") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_api_clients
formats(Brightbox::Compute::Formats::Collection::API_CLIENTS, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::API_CLIENTS, {:allow_extra_keys => true}) { result }
end
tests("#get_api_client('#{@api_client_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_api_client(@api_client_id)
formats(Brightbox::Compute::Formats::Full::API_CLIENT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::API_CLIENT, {:allow_extra_keys => true}) { result }
end
update_options = {:name => "Fog@#{Time.now.iso8601}"}
tests("#update_api_client('#{@api_client_id}', #{update_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].update_api_client(@api_client_id, update_options)
formats(Brightbox::Compute::Formats::Full::API_CLIENT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::API_CLIENT, {:allow_extra_keys => true}) { result }
end
tests("#reset_secret_api_client('#{@api_client_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].reset_secret_api_client(@api_client_id)
formats(Brightbox::Compute::Formats::Full::API_CLIENT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::API_CLIENT, {:allow_extra_keys => true}) { result }
test("new secret is visible") { ! result["secret"].nil? }
end
tests("#destroy_api_client('#{@api_client_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].destroy_api_client(@api_client_id)
formats(Brightbox::Compute::Formats::Full::API_CLIENT, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::API_CLIENT, {:allow_extra_keys => true}) { result }
end
end

View file

@ -10,39 +10,39 @@ Shindo.tests('Fog::Compute[:brightbox] | api client requests', ['brightbox']) do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].create_application(create_options)
@application_id = result["id"]
formats(Brightbox::Compute::Formats::Full::APPLICATION, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::APPLICATION, {:allow_extra_keys => true}) { result }
end
tests("#list_applications") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_applications
formats(Brightbox::Compute::Formats::Collection::APPLICATION, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::APPLICATION, {:allow_extra_keys => true}) { result }
end
tests("#get_application('#{@application_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_application(@application_id)
formats(Brightbox::Compute::Formats::Full::APPLICATION, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::APPLICATION, {:allow_extra_keys => true}) { result }
end
update_options = {:name => "Fog@#{Time.now.iso8601}"}
tests("#update_application('#{@application_id}', #{update_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].update_application(@application_id, update_options)
formats(Brightbox::Compute::Formats::Full::APPLICATION, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::APPLICATION, {:allow_extra_keys => true}) { result }
end
tests("#reset_secret_application('#{@application_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].reset_secret_application(@application_id)
formats(Brightbox::Compute::Formats::Full::APPLICATION, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::APPLICATION, {:allow_extra_keys => true}) { result }
test("new secret is visible") { ! result["secret"].nil? }
end
tests("#destroy_application('#{@application_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].destroy_application(@application_id)
formats(Brightbox::Compute::Formats::Full::APPLICATION, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::APPLICATION, {:allow_extra_keys => true}) { result }
end
end

View file

@ -10,19 +10,19 @@ Shindo.tests('Fog::Compute[:brightbox] | cloud ip requests', ['brightbox']) do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].create_cloud_ip
@cloud_ip_id = result["id"]
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::CLOUD_IP, {:allow_extra_keys => true}) { result }
end
tests("#list_cloud_ips") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_cloud_ips
formats(Brightbox::Compute::Formats::Collection::CLOUD_IPS, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::CLOUD_IPS, {:allow_extra_keys => true}) { result }
end
tests("#get_cloud_ip('#{@cloud_ip_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_cloud_ip(@cloud_ip_id)
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::CLOUD_IP, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?
@ -32,7 +32,7 @@ Shindo.tests('Fog::Compute[:brightbox] | cloud ip requests', ['brightbox']) do
tests("#map_cloud_ip('#{@cloud_ip_id}', #{map_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].map_cloud_ip(@cloud_ip_id, map_options)
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::CLOUD_IP, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?
@ -42,7 +42,7 @@ Shindo.tests('Fog::Compute[:brightbox] | cloud ip requests', ['brightbox']) do
tests("#unmap_cloud_ip('#{@cloud_ip_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].unmap_cloud_ip(@cloud_ip_id)
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::CLOUD_IP, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?
@ -52,14 +52,14 @@ Shindo.tests('Fog::Compute[:brightbox] | cloud ip requests', ['brightbox']) do
tests("#update_cloud_ip('#{@cloud_ip_id}', #{update_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].update_cloud_ip(@cloud_ip_id, update_options)
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::CLOUD_IP, {:allow_extra_keys => true}) { result }
result = Fog::Compute[:brightbox].update_cloud_ip(@cloud_ip_id, {:reverse_dns => ""})
end
tests("#destroy_cloud_ip('#{@cloud_ip_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].destroy_cloud_ip(@cloud_ip_id)
formats(Brightbox::Compute::Formats::Full::CLOUD_IP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::CLOUD_IP, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?

View file

@ -10,17 +10,17 @@ Shindo.tests('Fog::Compute[:brightbox] | firewall policy requests', ['brightbox'
tests("#create_firewall_policy(#{create_options.inspect})") do
result = Fog::Compute[:brightbox].create_firewall_policy(create_options)
@firewall_policy_id = result["id"]
formats(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, {:allow_extra_keys => true}) { result }
end
tests("#list_firewall_policies()") do
formats(Brightbox::Compute::Formats::Collection::FIREWALL_POLICIES, false) do
data_matches_schema(Brightbox::Compute::Formats::Collection::FIREWALL_POLICIES, {:allow_extra_keys => true}) do
Fog::Compute[:brightbox].list_firewall_policies
end
end
tests("#get_firewall_policy('#{@firewall_policy_id}')") do
formats(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, false) do
data_matches_schema(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, {:allow_extra_keys => true}) do
Fog::Compute[:brightbox].get_firewall_policy(@firewall_policy_id)
end
end
@ -28,13 +28,13 @@ Shindo.tests('Fog::Compute[:brightbox] | firewall policy requests', ['brightbox'
update_options = {:name => "Fog test policy B"}
tests("#update_firewall_policy('#{@firewall_policy_id}', #{update_options.inspect})") do
result = Fog::Compute[:brightbox].update_firewall_policy(@firewall_policy_id, update_options)
formats(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, {:allow_extra_keys => true}) { result }
returns("Fog test policy B") { result["name"] }
end
tests("#destroy_firewall_policy('#{@firewall_policy_id}')") do
result = Fog::Compute[:brightbox].destroy_firewall_policy(@firewall_policy_id)
formats(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::FIREWALL_POLICY, {:allow_extra_keys => true}) { result }
end
end
end

View file

@ -15,25 +15,25 @@ Shindo.tests('Fog::Compute[:brightbox] | firewall rule requests', ['brightbox'])
tests("#create_firewall_rule(#{create_options.inspect})") do
result = Fog::Compute[:brightbox].create_firewall_rule(create_options)
@firewall_rule_id = result["id"]
formats(Brightbox::Compute::Formats::Full::FIREWALL_RULE, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::FIREWALL_RULE, {:allow_extra_keys => true}) { result }
end
tests("#get_firewall_rule('#{@firewall_rule_id}')") do
formats(Brightbox::Compute::Formats::Full::FIREWALL_RULE, false) do
data_matches_schema(Brightbox::Compute::Formats::Full::FIREWALL_RULE, {:allow_extra_keys => true}) do
Fog::Compute[:brightbox].get_firewall_rule(@firewall_rule_id)
end
end
update_options = {:source => nil, :destination => "127.0.0.1"}
tests("#update_firewall_rule('#{@firewall_rule_id}', #{update_options.inspect})") do
formats(Brightbox::Compute::Formats::Full::FIREWALL_RULE, false) do
data_matches_schema(Brightbox::Compute::Formats::Full::FIREWALL_RULE, {:allow_extra_keys => true}) do
Fog::Compute[:brightbox].update_firewall_rule(@firewall_rule_id, update_options)
end
end
tests("#destroy_firewall_rule('#{@firewall_rule_id}')") do
result = Fog::Compute[:brightbox].destroy_firewall_rule(@firewall_rule_id)
formats(Brightbox::Compute::Formats::Full::FIREWALL_RULE, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::FIREWALL_RULE, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?

View file

@ -19,13 +19,13 @@ Shindo.tests('Fog::Compute[:brightbox] | image requests', ['brightbox']) do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_images
@image_id = result.first["id"]
formats(Brightbox::Compute::Formats::Collection::IMAGES, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::IMAGES, {:allow_extra_keys => true}) { result }
end
tests("#get_image('#{@image_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_image(@image_id)
formats(Brightbox::Compute::Formats::Full::IMAGE, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::IMAGE, {:allow_extra_keys => true}) { result }
end
## Until Image creation can be automated, we shouldn't be updating Images randomly

View file

@ -19,7 +19,7 @@ Shindo.tests('Fog::Compute[:brightbox] | interface requests', ['brightbox']) do
tests("#get_interface('#{@interface_id}')") do
pending if Fog.mocking?
result = @test_service.get_interface(@interface_id)
formats(Brightbox::Compute::Formats::Full::INTERFACE, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::INTERFACE, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?

View file

@ -26,7 +26,7 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox'])
pending if Fog.mocking?
result = Fog::Compute[:brightbox].create_load_balancer(create_options)
@load_balancer_id = result["id"]
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?
@ -36,34 +36,34 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox'])
tests("#list_load_balancers()") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_load_balancers
formats(Brightbox::Compute::Formats::Collection::LOAD_BALANCERS, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::LOAD_BALANCERS, {:allow_extra_keys => true}) { result }
end
tests("#get_load_balancer('#{@load_balancer_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_load_balancer(@load_balancer_id)
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
end
update_options = {:name => "New name"}
tests("#update_load_balancer('#{@load_balancer_id}', #{update_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].update_load_balancer(@load_balancer_id, update_options)
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
end
add_listeners_options = {:listeners=>[{:out=>28080, :in=>8080, :protocol=>"http"}]}
tests("#add_listeners_load_balancer('#{@load_balancer_id}', #{add_listeners_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].add_listeners_load_balancer(@load_balancer_id, add_listeners_options)
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
end
remove_listeners_options = {:listeners=>[{:out=>28080, :in=>8080, :protocol=>"http"}]}
tests("#remove_listeners_load_balancer('#{@load_balancer_id}', #{remove_listeners_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].remove_listeners_load_balancer(@load_balancer_id, remove_listeners_options)
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?
@ -76,7 +76,7 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox'])
tests("#add_nodes_load_balancer('#{@load_balancer_id}', #{add_nodes_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].add_nodes_load_balancer(@load_balancer_id, add_nodes_options)
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
end
# ...before we can attempt to remove either
@ -84,13 +84,13 @@ Shindo.tests('Fog::Compute[:brightbox] | load balancer requests', ['brightbox'])
tests("#remove_nodes_load_balancer('#{@load_balancer_id}', #{remove_nodes_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].remove_nodes_load_balancer(@load_balancer_id, remove_nodes_options)
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
end
tests("#destroy_load_balancer('#{@load_balancer_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].destroy_load_balancer(@load_balancer_id)
formats(Brightbox::Compute::Formats::Full::LOAD_BALANCER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::LOAD_BALANCER, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?

View file

@ -18,55 +18,55 @@ Shindo.tests('Fog::Compute[:brightbox] | server group requests', ['brightbox'])
pending if Fog.mocking?
result = Fog::Compute[:brightbox].create_server_group(create_options)
@server_group_id = result["id"]
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
end
tests("#list_server_groups") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_server_groups
formats(Brightbox::Compute::Formats::Collection::SERVER_GROUPS, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::SERVER_GROUPS, {:allow_extra_keys => true}) { result }
@default_group_id = result.select {|grp| grp["default"] == true }.first["id"]
end
tests("#get_server_group('#{@server_group_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_server_group(@server_group_id)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
end
update_options = {:name => "Fog@#{Time.now.iso8601}"}
tests("#update_server_group('#{@server_group_id}', #{update_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].update_server_group(@server_group_id, update_options)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
end
remove_options = {:servers => [{:server => server_id}]}
tests("#remove_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].remove_servers_server_group(@server_group_id, remove_options)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
end
add_options = {:servers => [{:server => server_id}]}
tests("#add_servers_server_group('#{@server_group_id}', #{remove_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].add_servers_server_group(@server_group_id, add_options)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
end
move_options = {:destination => @default_group_id, :servers => [{:server => server_id}]}
tests("#move_servers_server_group('#{@server_group_id}', #{move_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].move_servers_server_group(@server_group_id, move_options)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
test("group is emptied") { result["servers"].empty? }
end
tests("#destroy_server_group('#{@server_group_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].destroy_server_group(@server_group_id)
formats(Brightbox::Compute::Formats::Full::SERVER_GROUP, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_GROUP, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?

View file

@ -11,7 +11,7 @@ Shindo.tests('Fog::Compute[:brightbox] | server requests', ['brightbox']) do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].create_server(:image => image_id)
server_id = result["id"]
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
end
unless Fog.mocking?
@ -21,49 +21,49 @@ Shindo.tests('Fog::Compute[:brightbox] | server requests', ['brightbox']) do
tests("#list_servers") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_servers
formats(Brightbox::Compute::Formats::Collection::SERVERS, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::SERVERS, {:allow_extra_keys => true}) { result }
end
tests("#get_server('#{server_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
end
tests("#update_server('#{server_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].update_server(server_id, :name => "Fog@#{Time.now.iso8601}")
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
end
tests("#activate_console_server('#{server_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].activate_console_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
end
tests("#stop_server('#{server_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].stop_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
end
tests("#start_server('#{server_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].start_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
end
tests("#shutdown_server('#{server_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].shutdown_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
end
tests("#snapshot_server('#{server_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].snapshot_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
# Server should be exclusively for our test so assume we can delete the snapshot
snapshot_id = result["snapshots"].first["id"]
@snapshot = Fog::Compute[:brightbox].images.get(snapshot_id)
@ -74,7 +74,7 @@ Shindo.tests('Fog::Compute[:brightbox] | server requests', ['brightbox']) do
tests("#destroy_server('#{server_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].destroy_server(server_id)
formats(Brightbox::Compute::Formats::Full::SERVER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER, {:allow_extra_keys => true}) { result }
end
end

View file

@ -6,13 +6,13 @@ Shindo.tests('Fog::Compute[:brightbox] | server type requests', ['brightbox']) d
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_server_types
@server_type_id = result.first["id"]
formats(Brightbox::Compute::Formats::Collection::SERVER_TYPES, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::SERVER_TYPES, {:allow_extra_keys => true}) { result }
end
tests("#get_server_type('#{@server_type_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_server_type(@server_type_id)
formats(Brightbox::Compute::Formats::Full::SERVER_TYPE, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::SERVER_TYPE, {:allow_extra_keys => true}) { result }
end
end

View file

@ -6,20 +6,20 @@ Shindo.tests('Fog::Compute[:brightbox] | user requests', ['brightbox']) do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_users
@user_id = result.first["id"]
formats(Brightbox::Compute::Formats::Collection::USERS, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::USERS, {:allow_extra_keys => true}) { result }
end
tests("#get_user('#{@user_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_user(@user_id)
formats(Brightbox::Compute::Formats::Full::USER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::USER, {:allow_extra_keys => true}) { result }
end
update_options = { :name => "Example User" }
tests("#update_user('#{@user_id}', #{update_options.inspect})") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].update_user(@user_id, update_options)
formats(Brightbox::Compute::Formats::Full::USER, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::USER, {:allow_extra_keys => true}) { result }
end
end

View file

@ -6,13 +6,13 @@ Shindo.tests('Fog::Compute[:brightbox] | zone requests', ['brightbox']) do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].list_zones
@zone_id = result.first["id"]
formats(Brightbox::Compute::Formats::Collection::ZONES, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Collection::ZONES, {:allow_extra_keys => true}) { result }
end
tests("#get_zone('#{@zone_id}')") do
pending if Fog.mocking?
result = Fog::Compute[:brightbox].get_zone(@zone_id)
formats(Brightbox::Compute::Formats::Full::ZONE, false) { result }
data_matches_schema(Brightbox::Compute::Formats::Full::ZONE, {:allow_extra_keys => true}) { result }
end
end