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
|
|
|
|
vdc = @service.get_vdc(@vdc_id).body
|
2013-09-26 06:29:51 -04:00
|
|
|
vdc[:AvailableNetworks][:Network] = [vdc[:AvailableNetworks][:Network]] if vdc[:AvailableNetworks][:Network].is_a?(Hash)
|
|
|
|
vdc[:ResourceEntities][:ResourceEntity] = [vdc[:ResourceEntities][:ResourceEntity]] if vdc[:ResourceEntities][:ResourceEntity].is_a?(Hash)
|
2013-10-13 11:18:59 -04:00
|
|
|
vdc[:VdcStorageProfiles][:VdcStorageProfile] = [vdc[:VdcStorageProfiles][:VdcStorageProfile]] if vdc[:VdcStorageProfiles][:VdcStorageProfile].is_a?(Hash)
|
2013-09-26 06:29:51 -04:00
|
|
|
vdc
|
|
|
|
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
|
|
|
|
|
|
|
|
tests('#get_vdcs_from_query').data_matches_schema(VcloudDirector::Compute::Schema::CONTAINER_TYPE) do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
@service.get_vdcs_from_query.body
|
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
|