Sha256: 815bd25f3118626f01b12b30dffb5e3dc9d1b61093e9a543eb55ef5b99262ec6

Contents?: true

Size: 1.33 KB

Versions: 2

Compression:

Stored size: 1.33 KB

Contents

Shindo.tests('Compute::VcloudDirector | ovf requests', ['vclouddirector']) do

  @service = Fog::VcloudDirector::Compute.new
  @org = VcloudDirector::Compute::Helper.current_org(@service)

  tests('Get first vDC') do
    session = @service.get_current_session.body
    link = @org[:Link].find do |l|
      l[:type] == 'application/vnd.vmware.vcloud.vdc+xml'
    end
    @vdc = @service.get_vdc(link[:href].split('/').last).body
  end

  # 'Envelope' is the outer type of the parsed XML document.
  tests('#get_vapp_ovf_descriptor').returns('Envelope') do
    pending if Fog.mocking?
    link = @vdc[:ResourceEntities][:ResourceEntity].find do |l|
      l[:type] == 'application/vnd.vmware.vcloud.vApp+xml'
    end
    pending if link.nil?
    body = @service.get_vapp_ovf_descriptor(link[:href].split('/').last).body
    Nokogiri::XML::Document.parse(body).children.first.name
  end

  # 'Envelope' is the outer type of the parsed XML document.
  tests('#get_vapp_template_ovf_descriptor').returns('Envelope') do
    pending if Fog.mocking?
    link = @vdc[:ResourceEntities][:ResourceEntity].find do |l|
      l[:type] == 'application/vnd.vmware.vcloud.vAppTemplate+xml'
    end
    pending if link.nil?
    body = @service.get_vapp_template_ovf_descriptor(link[:href].split('/').last).body
    Nokogiri::XML::Document.parse(body).children.first.name
  end

end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
fog-vcloud-director-0.3.1 tests/vcloud_director/requests/compute/ovf_descriptor_tests.rb
fog-vcloud-director-0.3.0 tests/vcloud_director/requests/compute/ovf_descriptor_tests.rb