2013-09-26 06:29:51 -04:00
|
|
|
Shindo.tests('Compute::VcloudDirector | vdc requests', ['vclouddirector']) do
|
|
|
|
|
|
|
|
@service = Fog::Compute::VcloudDirector.new
|
2013-10-08 13:46:06 -04:00
|
|
|
@org = VcloudDirector::Compute::Helper.current_org(@service)
|
2013-09-26 06:29:51 -04:00
|
|
|
|
2013-09-27 11:32:49 -04:00
|
|
|
tests('#get_vdc').data_matches_schema(VcloudDirector::Compute::Schema::VDC_TYPE) do
|
2013-09-29 16:27:58 -04:00
|
|
|
link = @org[:Link].detect do |l|
|
|
|
|
l[:rel] == 'down' && l[:type] == 'application/vnd.vmware.vcloud.vdc+xml'
|
|
|
|
end
|
2013-10-08 13:46:06 -04:00
|
|
|
@vdc_id = link[:href].split('/').last
|
2013-10-15 07:41:15 -04:00
|
|
|
@service.get_vdc(@vdc_id).body
|
2013-09-26 06:29:51 -04:00
|
|
|
end
|
|
|
|
|
2013-10-08 13:46:06 -04:00
|
|
|
tests('#get_vdc_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do
|
|
|
|
pending if Fog.mocking?
|
2013-10-13 19:50:11 -04:00
|
|
|
@service.get_vdc_metadata(@vdc_id).body
|
|
|
|
end
|
|
|
|
|
2013-10-15 07:41:15 -04:00
|
|
|
tests('#get_vdcs_from_query') do
|
2013-10-13 19:50:11 -04:00
|
|
|
pending if Fog.mocking?
|
2013-10-15 07:41:15 -04:00
|
|
|
%w[idrecords records references].each do |format|
|
|
|
|
tests(":format => #{format}") do
|
|
|
|
tests('#body').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
|
|
|
@body = @service.get_vdcs_from_query(:format => format).body
|
|
|
|
end
|
|
|
|
key = (format == 'references') ? 'OrgVdcReference' : 'OrgVdcRecord'
|
|
|
|
tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) }
|
|
|
|
end
|
|
|
|
end
|
2013-10-08 13:46:06 -04:00
|
|
|
end
|
|
|
|
|
2013-10-13 15:46:41 -04:00
|
|
|
tests('Retrieve non-existent vDC').raises(Fog::Compute::VcloudDirector::Forbidden) do
|
2013-09-27 11:32:49 -04:00
|
|
|
@service.get_vdc('00000000-0000-0000-0000-000000000000')
|
|
|
|
end
|
|
|
|
|
2013-09-26 06:29:51 -04:00
|
|
|
end
|