Sha256: 36db36a33613cd5799108441b9f7ce58f12957f7411e026d4e01a32dca4f1ab1

Contents?: true

Size: 1.12 KB

Versions: 1

Compression:

Stored size: 1.12 KB

Contents

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

# Test class for List Traffic Manager Profiles
class TestListTrafficManagerProfiles < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @token_provider = Fog::Credentials::AzureRM.instance_variable_get(:@token_provider)
  end

  def test_list_traffic_manager_profiles_success
    response = ApiStub::Requests::Network::TrafficManagerProfile.list_traffic_manager_profiles_response
    @token_provider.stub :get_authentication_header, 'Bearer <some-token>' do
      RestClient.stub :get, response do
        assert @service.list_traffic_manager_profiles('fog-test-rg')
      end
    end
  end

  def test_list_traffic_manager_profiles_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.list_traffic_manager_profiles('fog-test-rg')
      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_list_traffic_manager_profiles.rb