Sha256: a409c56f1feda47b1dfafeacc5da728f9c6df215963417ab766980311f2424ed

Contents?: true

Size: 1.59 KB

Versions: 20

Compression:

Stored size: 1.59 KB

Contents

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

# Test class for List Available Sizes For VirtualMachine Request
class TestListAvailableSizesForVirtualMachine < 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_available_sizes_for_virtual_machine_success
    response = ApiStub::Requests::Compute::VirtualMachine.list_available_sizes_for_virtual_machine_response(@compute_client)
    @virtual_machines.stub :list_available_sizes, response do
      assert_equal @service.list_available_sizes_for_virtual_machine('fog-test-rg', 'fog-test-server', false), response.value
    end

    async_response = Concurrent::Promise.execute { 10 }
    @virtual_machines.stub :list_available_sizes_async, async_response do
      assert @service.list_available_sizes_for_virtual_machine('fog-test-rg', 'fog-test-server', true), async_response
    end
  end

  def test_list_available_sizes_for_virtual_machine_failure
    response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @virtual_machines.stub :list_available_sizes, response do
      assert_raises(RuntimeError) { @service.list_available_sizes_for_virtual_machine('fog-test-rg', 'fog-test-server', false) }
    end

    @virtual_machines.stub :list_available_sizes_async, response do
      assert_raises(RuntimeError) { @service.list_available_sizes_for_virtual_machine('fog-test-rg', 'fog-test-server', true) }
    end
  end
end

Version data entries

20 entries across 20 versions & 3 rubygems

Version Path
fog-azure-rm-0.4.5 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-temp-0.0.5 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.4.4 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.4.3 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
far-gem-0.5.1 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.4.2 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.4.1 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.4.0 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.3.9 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.3.8 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.3.7 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.3.6 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.3.5 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.3.4 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-temp-0.0.4 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-temp-0.0.3 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.3.3 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-temp-0.0.2 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-temp-0.0.1 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb
fog-azure-rm-0.3.2 test/requests/compute/test_list_available_sizes_for_virtual_machine.rb