Sha256: 914a972952c15eff23345dd0914e4799520a248c72ecba20748a20e2f84017c8

Contents?: true

Size: 964 Bytes

Versions: 6

Compression:

Stored size: 964 Bytes

Contents

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

# Test class for List Subnets Request
class TestListSubnets < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @network_client = @service.instance_variable_get(:@network_client)
    @subnets = @network_client.subnets
  end

  def test_list_subnets_success
    mocked_response = ApiStub::Requests::Network::Subnet.list_subnets_response(@network_client)
    @subnets.stub :list_as_lazy, mocked_response do
      assert_equal @service.list_subnets('fog-test-rg', 'fog-test-virtual-network'), mocked_response.value
    end
  end

  def test_list_subnets_failure
    response = proc { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @subnets.stub :list_as_lazy, response do
      assert_raises(RuntimeError) { @service.list_subnets('fog-test-rg', 'fog-test-virtual-network') }
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

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