2013-09-26 06:29:51 -04:00
|
|
|
Shindo.tests('Compute::VcloudDirector | organization requests', ['vclouddirector']) do
|
|
|
|
|
|
|
|
@service = Fog::Compute::VcloudDirector.new
|
|
|
|
|
2013-09-27 11:32:49 -04:00
|
|
|
tests('#get_organizations').data_matches_schema(VcloudDirector::Compute::Schema::ORG_LIST_TYPE) do
|
2013-09-26 06:29:51 -04:00
|
|
|
@org_list = @service.get_organizations.body
|
|
|
|
end
|
|
|
|
|
2013-09-27 11:32:49 -04:00
|
|
|
tests('#get_organization').data_matches_schema(VcloudDirector::Compute::Schema::ORG_TYPE) do
|
2014-05-22 21:40:43 -04:00
|
|
|
org = @org_list[:Org].find {|o| o[:name] == @service.org_name}
|
2013-10-08 13:46:06 -04:00
|
|
|
@org_uuid = org[:href].split('/').last
|
2013-10-11 03:33:47 -04:00
|
|
|
@service.get_organization(@org_uuid).body
|
2013-10-08 13:46:06 -04:00
|
|
|
end
|
|
|
|
|
|
|
|
tests('#get_organization_metadata').data_matches_schema(VcloudDirector::Compute::Schema::METADATA_TYPE) do
|
|
|
|
pending if Fog.mocking?
|
|
|
|
@service.get_organization_metadata(@org_uuid).body
|
2013-09-26 06:29:51 -04:00
|
|
|
end
|
|
|
|
|
2013-10-15 07:41:15 -04:00
|
|
|
tests('#get_organizations_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_organizations_from_query(:format => format).body
|
|
|
|
end
|
|
|
|
key = (format == 'references') ? 'OrganizationReference' : 'OrganizationRecord'
|
|
|
|
tests("#body.key?(:#{key})").returns(true) { @body.key?(key.to_sym) }
|
|
|
|
end
|
|
|
|
end
|
2013-10-13 19:50:11 -04:00
|
|
|
end
|
|
|
|
|
2013-10-13 15:46:41 -04:00
|
|
|
tests('retrieve non-existent Org').raises(Fog::Compute::VcloudDirector::Forbidden) do
|
2013-09-27 11:32:49 -04:00
|
|
|
@service.get_organization('00000000-0000-0000-0000-000000000000')
|
|
|
|
end
|
|
|
|
|
2013-09-26 06:29:51 -04:00
|
|
|
end
|