Sha256: e6d9ba1a7cd681725644c196d98de1d4ee49ff794c530881a005f5a578e3a607

Contents?: true

Size: 973 Bytes

Versions: 34

Compression:

Stored size: 973 Bytes

Contents

Shindo.tests('Fog::Compute[:vsphere] | find_vm_by_ref request', ['vsphere']) do

  compute = Fog::Compute[:vsphere]

  tests("When missing arguments") do
    raises(ArgumentError, "Should raise ArgumentError when missing :vm_ref") do
      compute.find_vm_by_ref
    end
    raises(Fog::Compute::Vsphere::NotFound, "Should raise Fog::Compute::Vsphere::NotFound when the vm does not exist") do
      compute.find_vm_by_ref('vm_ref' => 'vm-000')
    end
  end

  # centos56gm is a template
  existing_vms = { 'vm-715' => 'jefftest', 'vm-698' => 'centos56gm' }

  tests("When looking for existing VM's the response") do
    existing_vms.each do |ref,name|
      response = compute.find_vm_by_ref('vm_ref' => ref)
      test("should be a kind of Hash") { response.kind_of? Hash }
      test("should have virtual_machine key") { response.has_key? 'virtual_machine' }
      returns(name, "#{ref} should return #{name}") { response['virtual_machine']['name'] }
    end
  end

end

Version data entries

34 entries across 34 versions & 11 rubygems

Version Path
fog-parser-fix-1.6.1 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-test-again-1.6.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-parser-fix-1.6.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-maestrodev-1.7.0.20121114190951 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.7.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.6.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.5.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
rackspace-fog-1.4.2 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.4.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.18.1 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
michiels-fog-1.3.1 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
ftl-0.2.0 vendor/bundle/gems/fog-1.3.1/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.18.0 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.3.1 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.3.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.17.5 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.2.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
ktheory-fog-1.1.2 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.17.4 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.17.3 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb