Sha256: 1cc20735f2d32804f9f75014fffbc6906c4a8d4c8ff9bb326dfa04f18f7c186e

Contents?: true

Size: 1011 Bytes

Versions: 14

Compression:

Stored size: 1011 Bytes

Contents

require 'spec_helper'

describe Vcloud::Fog::ModelInterface do

  it "should retrive logged in organization" do
    vm_href, vdc_href = 'https://vmware.net/vapp/vm-1', 'vdc/vdc-1'
    vm = double(:vm, :href => vm_href)
    vdc = double(:vdc1,
                 :id => 'vdc-1',
                 :href => vdc_href,
                 :vapps => double(:vapps, :get_by_name => double(:vapp, :name => 'vapp-1', :vms => [vm])))
    org = double(:hr, :name => 'HR ORG', :vdcs => [vdc])

    vcloud = double(:mock_vcloud, :org_name => 'HR', :organizations => double(:orgs, :get_by_name => org))
    vcloud.should_receive(:get_vms_in_lease_from_query).with({:filter => "href==#{vm_href}"}).and_return(
        double(
            :vm_query_record,
            :body => {:VMRecord => [{:href => vm_href, :containerName => 'vapp-1', :vdc => vdc_href}]}
        )
    )
    Fog::Compute::VcloudDirector.should_receive(:new).and_return(vcloud)

    Vcloud::Fog::ModelInterface.new.get_vm_by_href(vm_href).should == vm
  end
end

Version data entries

14 entries across 14 versions & 1 rubygems

Version Path
vcloud-core-0.1.0 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.13 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.12 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.11 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.10 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.9 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.8 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.7 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.6 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.5 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.4 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.3 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.2 spec/vcloud/fog/fog_model_interface_spec.rb
vcloud-core-0.0.1 spec/vcloud/fog/fog_model_interface_spec.rb