Sha256: 70fb2d53d8fbe30f9ef7bd0e57a01cc4d03d2a25b023ba6c45252a86cc1ce0b1

Contents?: true

Size: 1.08 KB

Versions: 1

Compression:

Stored size: 1.08 KB

Contents

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

# Test class for List Availability Sets Request
class TestListAvailabilitySet < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    client = @service.instance_variable_get(:@compute_mgmt_client)
    @availability_sets = client.availability_sets
    @promise = Concurrent::Promise.execute do
    end
  end

  def test_list_availability_set_success
    response = ApiStub::Requests::Compute::AvailabilitySet.list_availability_set_response
    @promise.stub :value!, response do
      @availability_sets.stub :list, @promise do
        assert @service.list_availability_sets('fog-test-rg'), response
      end
    end
  end

  def test_list_availability_set_failure
    response = -> { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @promise.stub :value!, response do
      @availability_sets.stub :list, @promise do
        assert_raises(RuntimeError) { @service.list_availability_sets('fog-test-rg') }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.4 test/requests/compute/test_list_availability_sets.rb