Sha256: 331371d065123aac23fc4848309cb15e39e928ce55962780e9481fae95440401

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 Traffic Manager Profile
class TestDeleteTrafficManagerProfile < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
  end

  def test_delete_traffic_manager_profile_success
    @token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
      RestClient.stub :delete, true do
        assert @service.delete_traffic_manager_profile('fog-test-rg', 'fog-test-profile')
      end
    end
  end

  def test_delete_traffic_manager_profile_failure
    exception = RestClient::Exception.new
    exception.instance_variable_set(:@response, '{"code": "ResourceNotFound", "message": "mocked exception message"}')
    response = -> { raise exception }
    @token_provider.stub :get_authentication_header, response do
      assert_raises RuntimeError do
        @service.delete_traffic_manager_profile('fog-test-rg', 'fog-test-profile')
      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_traffic_manager_profile.rb