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

using new way of task mocking for edgegateway tests

This commit is contained in:
Sneha Somwanshi 2013-10-31 16:47:44 +00:00
parent 64c1458099
commit aa94d9d57c
2 changed files with 22 additions and 4 deletions

View file

@ -42,8 +42,26 @@ module Fog
"No access to entity \"(com.vmware.vcloud.entity.edgegateway:#{id})\"."
)
end
data[:edge_gateways][id][:Configuration][:EdgeGatewayServiceConfiguration] = configuration
Excon::Response.new(:body => {:name => 'mock_task', :href => '/10000000000000000000000000000000' })
owner = {:href => '', :name => nil, :type => nil} #known-bug: admin-api does not return owner.
task_id = enqueue_task(
"Configuring edgegateway(#{id})", 'networkConfigureEdgeGatewayServices', owner,
:on_success => lambda do
data[:edge_gateways][id][:Configuration][:EdgeGatewayServiceConfiguration] = configuration
end
)
body = {
:xmlns => xmlns,
:xmlns_xsi => xmlns_xsi,
:xsi_schemaLocation => xsi_schema_location,
}.merge(task_body(task_id))
Excon::Response.new(
:status => 202,
:headers => {'Content-Type' => "#{body[:type]};version=#{api_version}"},
:body => body
)
end
end
end

View file

@ -66,7 +66,7 @@ Shindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector
raise('fail fast if our test firewall rule already exists - its likely left over from a broken test run') if rule
response = @service.post_configure_edge_gateway_services(@edge_gateway_id, @new_edge_gateway_configuration)
@service.process_task(response.body) unless Fog.mocking?
@service.process_task(response.body)
tests('#check for new firewall rule').returns(@new_edge_gateway_configuration[:FirewallService][:FirewallRule]) do
edge_gateway = @service.get_edge_gateway(@edge_gateway_id).body
@ -76,7 +76,7 @@ Shindo.tests('Compute::VcloudDirector | edge gateway requests', ['vclouddirector
tests('#remove the firewall rule added by test').returns(nil) do
response = @service.post_configure_edge_gateway_services(@edge_gateway_id,
@orginal_gateway_conf[:Configuration][:EdgeGatewayServiceConfiguration])
@service.process_task(response.body) unless Fog.mocking?
@service.process_task(response.body)
edge_gateway = @service.get_edge_gateway(@edge_gateway_id).body
edge_gateway[:Configuration][:EdgeGatewayServiceConfiguration][:FirewallService][:FirewallRule].find { |rule| rule[:Id] == FIREWALL_RULE_ID }
end