Sha256: 6697642a3bd3d9399566d35362cb3b329a6ec26a8a6ebd181e53242f071544aa

Contents?: true

Size: 1.06 KB

Versions: 1

Compression:

Stored size: 1.06 KB

Contents

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

# Test class for Delete Subnet Request
class TestDeleteSubnet < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    client = @service.instance_variable_get(:@network_client)
    @subnets = client.subnets
    @promise = Concurrent::Promise.execute do
    end
  end

  def test_delete_subnet_success
    response = ApiStub::Requests::Network::Subnet.delete_subnet_response
    @promise.stub :value!, response do
      @subnets.stub :delete, @promise do
        assert @service.delete_subnet('fog-test-rg', 'fog-test-subnet', 'fog-test-virtual-network')
      end
    end
  end

  def test_delete_subnet_failure
    response = -> { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @promise.stub :value!, response do
      @subnets.stub :delete, @promise do
        assert_raises(RuntimeError) { @service.delete_subnet('fog-test-rg', 'fog-test-subnet', 'fog-test-virtual-network') }
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.4 test/requests/network/test_delete_subnet.rb