Sha256: b9bd1a10cf93fca37458961d9bec936ec53aba6f467a7c6b8519da00cad37ec8

Contents?: true

Size: 1.43 KB

Versions: 3

Compression:

Stored size: 1.43 KB

Contents

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

# Test class for Subnet Collection
class TestSubnets < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @subnets = Fog::Network::AzureRM::Subnets.new(resource_group: 'fog-test-rg', virtual_network_name: 'fog-test-virtual-network', service: @service)
    @network_client = @service.instance_variable_get(:@network_client)
  end

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

  def test_collection_attributes
    assert_respond_to @subnets, :resource_group
    assert_respond_to @subnets, :virtual_network_name
  end

  def test_all_method_response
    response = [ApiStub::Models::Network::Subnet.create_subnet_response(@network_client)]
    @service.stub :list_subnets, response do
      assert_instance_of Fog::Network::AzureRM::Subnets, @subnets.all
      assert @subnets.all.size >= 1
      @subnets.all.each do |subnet|
        assert_instance_of Fog::Network::AzureRM::Subnet, subnet
      end
    end
  end

  def test_get_method_response
    response = ApiStub::Models::Network::Subnet.create_subnet_response(@network_client)
    @service.stub :get_subnet, response do
      assert_instance_of Fog::Network::AzureRM::Subnet, @subnets.get('fog-test-rg', 'fog-test-vnet', 'fog-test-subnet')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/models/network/test_subnets.rb
fog-azure-rm-0.1.0 test/models/network/test_subnets.rb
fog-azure-rm-0.0.9 test/models/network/test_subnets.rb