Sha256: fc8cdcc7d8bce63900b2952c9052de11dbc983af71e23b746da3cc57e3c4f7de

Contents?: true

Size: 1.15 KB

Versions: 15

Compression:

Stored size: 1.15 KB

Contents

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

# Test class for Create Availability Set Request
class TestCreateAvailabilitySet < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    @client = @service.instance_variable_get(:@compute_mgmt_client)
    @availability_sets = @client.availability_sets
  end

  def test_create_availability_set_success
    mocked_response = ApiStub::Requests::Compute::AvailabilitySet.create_availability_set_response(@client)
    @availability_sets.stub :validate_params, true do
      @availability_sets.stub :create_or_update, mocked_response do
        assert_equal @service.create_availability_set('fog-test-rg', 'myavset1', 'west us'), mocked_response
      end
    end
  end

  def test_create_availability_set_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @availability_sets.stub :validate_params, true do
      @availability_sets.stub :create_or_update, response do
        assert_raises(RuntimeError) { @service.create_availability_set('fog-test-rg', 'fog-test-as', 'west us') }
      end
    end
  end
end

Version data entries

15 entries across 15 versions & 3 rubygems

Version Path
fog-azure-rm-temp-0.0.1 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.3.2 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-downgraded-0.3.1 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.3.1 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-downgraded-0.3.0 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.3.0 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.2.7 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.2.6 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.2.5 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.2.4 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.2.3 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.2.2 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.2.1 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.2.0 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.1.2 test/requests/compute/test_create_availability_set.rb