Sha256: b5e4fc5720ef2d1feda3a8739dd2ff3d1e3c754560098b66daefb4eb453c600a

Contents?: true

Size: 993 Bytes

Versions: 14

Compression:

Stored size: 993 Bytes

Contents

require File.expand_path '../../test_helper', __dir__

# Test class for List Virtual Machines Request
class TestListVirtualMachines < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    @compute_client = @service.instance_variable_get(:@compute_mgmt_client)
    @virtual_machines = @compute_client.virtual_machines
  end

  def test_list_virtual_machines_success
    response = ApiStub::Requests::Compute::VirtualMachine.list_virtual_machines_response(@compute_client)
    @virtual_machines.stub :list_as_lazy, response do
      assert_equal @service.list_virtual_machines('fog-test-rg'), response.value
    end
  end

  def test_list_virtual_machines_failure
    response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @virtual_machines.stub :list_as_lazy, response do
      assert_raises(MsRestAzure::AzureOperationError) { @service.list_virtual_machines('fog-test-rg') }
    end
  end
end

Version data entries

14 entries across 14 versions & 2 rubygems

Version Path
fog-azure-rm-0.6.0 test/requests/compute/test_list_virtual_machines.rb
fog-azure-rm-0.5.3 test/requests/compute/test_list_virtual_machines.rb
fog-azure-rm-0.5.2 test/requests/compute/test_list_virtual_machines.rb
far-gem-0.5.6 test/requests/compute/test_list_virtual_machines.rb
fog-azure-rm-0.5.1 test/requests/compute/test_list_virtual_machines.rb
far-gem-0.5.5 test/requests/compute/test_list_virtual_machines.rb
fog-azure-rm-0.5.0 test/requests/compute/test_list_virtual_machines.rb
far-gem-0.5.4 test/requests/compute/test_list_virtual_machines.rb
far-gem-0.5.3 test/requests/compute/test_list_virtual_machines.rb
fog-azure-rm-0.4.9 test/requests/compute/test_list_virtual_machines.rb
far-gem-0.5.2 test/requests/compute/test_list_virtual_machines.rb
fog-azure-rm-0.4.8 test/requests/compute/test_list_virtual_machines.rb
fog-azure-rm-0.4.7 test/requests/compute/test_list_virtual_machines.rb
fog-azure-rm-0.4.6 test/requests/compute/test_list_virtual_machines.rb