Sha256: 05439ae4425a27e7fe4a3b9a8861b5956ecd494444c28f69a0244c2bf8d61869
Contents?: true
Size: 1.39 KB
Versions: 1
Compression:
Stored size: 1.39 KB
Contents
require File.expand_path '../../test_helper', __dir__ # Test class for Check for Public Ip Request class TestCheckForPublicIp < Minitest::Test def setup @service = Fog::Network::AzureRM.new(credentials) client = @service.instance_variable_get(:@network_client) @public_ips = client.public_ipaddresses @promise = Concurrent::Promise.execute do end end def test_check_for_public_ip_success @promise.stub :value!, true do @public_ips.stub :get, @promise do assert @service.check_for_public_ip('fog-test-rg', 'fog-test-public-ip') end end end def test_check_for_public_ip_failure response = -> { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) } @promise.stub :value!, response do @public_ips.stub :get, @promise do assert !@service.check_for_public_ip('fog-test-rg', 'fog-test-public-ip') end end end def test_check_for_public_ip_exception response = -> { raise MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) } @promise.stub :value!, response do @public_ips.stub :get, @promise do assert_raises(RuntimeError) { @service.check_for_public_ip('fog-test-rg', 'fog-test-public-ip') } 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_check_for_public_ip.rb |