Sha256: e08f51e5681932dc337a8594b4bb25a52e9df3fbd6fc6b70d49d90fb6a28de5d

Contents?: true

Size: 1.95 KB

Versions: 46

Compression:

Stored size: 1.95 KB

Contents

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

# Test class for Availability Set Collection
class TestAvailabilitySets < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    @availability_sets = Fog::Compute::AzureRM::AvailabilitySets.new(resource_group: 'fog-test-rg', service: @service)
    client = @service.instance_variable_get(:@compute_mgmt_client)
    @availability_set_list = [ApiStub::Models::Compute::AvailabilitySet.list_availability_set_response(client)]
    @availability_set = ApiStub::Models::Compute::AvailabilitySet.get_availability_set_response(client)
  end

  def test_collection_methods
    methods = [
      :all,
      :get,
      :check_availability_set_exists
    ]
    methods.each do |method|
      assert_respond_to @availability_sets, method
    end
  end

  def test_collection_attributes
    assert_respond_to @availability_sets, :resource_group
  end

  def test_all_method_response
    @service.stub :list_availability_sets, @availability_set_list do
      assert_instance_of Fog::Compute::AzureRM::AvailabilitySets, @availability_sets.all
      assert @availability_sets.all.size >= 1
      @availability_sets.all.each do |s|
        assert_instance_of Fog::Compute::AzureRM::AvailabilitySet, s
      end
    end
  end

  def test_get_method_response
    @service.stub :get_availability_set, @availability_set do
      assert_instance_of Fog::Compute::AzureRM::AvailabilitySet, @availability_sets.get('fog-test-rg', 'fog-test-availability-set')
    end
  end

  def test_check_availability_set_exists_true_case
    @service.stub :check_availability_set_exists, true do
      assert @availability_sets.check_availability_set_exists('fog-test-rg', 'fog-test-availability-set')
    end
  end

  def test_check_availability_set_exists_false_case
    @service.stub :check_availability_set_exists, false do
      assert !@availability_sets.check_availability_set_exists('fog-test-rg', 'fog-test-availability-set')
    end
  end
end

Version data entries

46 entries across 46 versions & 4 rubygems

Version Path
fog-azure-rm-0.4.1 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.4.0 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.9 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.8 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.7 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.6 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.5 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.4 test/models/compute/test_availability_sets.rb
fog-azure-rm-temp-0.0.4 test/models/compute/test_availability_sets.rb
fog-azure-rm-temp-0.0.3 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.3 test/models/compute/test_availability_sets.rb
fog-azure-rm-temp-0.0.2 test/models/compute/test_availability_sets.rb
fog-azure-rm-temp-0.0.1 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.2 test/models/compute/test_availability_sets.rb
fog-azure-rm-downgraded-0.3.1 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.1 test/models/compute/test_availability_sets.rb
fog-azure-rm-downgraded-0.3.0 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.3.0 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.2.7 test/models/compute/test_availability_sets.rb
fog-azure-rm-0.2.6 test/models/compute/test_availability_sets.rb