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
brightbox-cli-0.17.2 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.17.1 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.17.0 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.1.2 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog_tractical-1.1.4 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog_tractical-1.1.3 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.16.0 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.1.1 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.1.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.15.0 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
tag-fog-1.0.1 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.14.1 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
brightbox-cli-0.14.0 lib/brightbox-cli/vendor/fog/tests/vsphere/requests/compute/find_vm_by_ref_tests.rb
fog-1.0.0 tests/vsphere/requests/compute/find_vm_by_ref_tests.rb