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

fix tests for running against live environment

This commit is contained in:
Mike Pountney 2013-12-12 16:21:18 +00:00
parent 532d81e639
commit 57ca79a37b

View file

@ -19,17 +19,35 @@ Shindo.tests('Compute::VcloudDirector | query requests', ['vclouddirector']) do
end.sort_by do |link|
[link[:name], link[:href]]
end.each do |link|
href = Nokogiri::XML.fragment(link[:href])
query = CGI.parse(URI.parse(href.text).query)
type = query['type'].first
format = query['format'].first
next if %w[right role strandedUser].include?(type)
tests("type => #{type}, format => #{format}") do
pending if Fog.mocking? && (format != 'records' || type != 'orgVdcNetwork')
tests("#get_execute_query").data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
@body = @service.get_execute_query(type, :format => format).body
end
tests("resource type").returns(link[:type]) { @body[:type] }
unless ( type == 'event' || type == 'edgeGateway' )
records_key = @body.keys.detect {|key| key.to_s =~ /Record|Reference$/}
if records = @body[records_key]
records.first do |record|
case format
when 'records'
tests("record is correct schema").data_matches_schema(VcloudDirector::Compute::Schema::REFERENCE_TYPE) do
record
end
end
end
end
end
end
end