Sha256: f216239795249605bec359f99723b4b21b0e6c0217fc014a15ecbfa323b4cd3c

Contents?: true

Size: 1.18 KB

Versions: 6

Compression:

Stored size: 1.18 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

6 entries across 6 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.1.0 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.0.9 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.0.8 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.0.6 test/requests/compute/test_create_availability_set.rb
fog-azure-rm-0.0.5 test/requests/compute/test_create_availability_set.rb