Sha256: 1baf2044a3dc4d3ffded9b505a4aa34d5f7bbbef182747db7fe0a8571ea91b57

Contents?: true

Size: 1.7 KB

Versions: 3

Compression:

Stored size: 1.7 KB

Contents

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

# Test class for Traffic Manager Profile Collection
class TestTrafficManagerProfiles < Minitest::Test
  def setup
    @service = Fog::TrafficManager::AzureRM.new(credentials)
    @traffic_manager_profiles = Fog::TrafficManager::AzureRM::TrafficManagerProfiles.new(resource_group: 'fog-test-rg', service: @service)
    traffic_manager_client = @service.instance_variable_get(:@traffic_mgmt_client)
    @profiles_list = [ApiStub::Models::TrafficManager::TrafficManagerProfile.traffic_manager_profile_response(traffic_manager_client)]
    @profile = ApiStub::Models::TrafficManager::TrafficManagerProfile.traffic_manager_profile_response(traffic_manager_client)
  end

  def test_collection_methods
    methods = [
      :all,
      :get
    ]
    methods.each do |method|
      assert_respond_to @traffic_manager_profiles, method
    end
  end

  def test_collection_attributes
    assert_respond_to @traffic_manager_profiles, :resource_group
  end

  def test_all_method_response
    @service.stub :list_traffic_manager_profiles, @profiles_list do
      assert_instance_of Fog::TrafficManager::AzureRM::TrafficManagerProfiles, @traffic_manager_profiles.all
      assert @traffic_manager_profiles.all.size >= 1
      @traffic_manager_profiles.all.each do |endpoint|
        assert_instance_of Fog::TrafficManager::AzureRM::TrafficManagerProfile, endpoint
      end
    end
  end

  def test_get_method_response
    @service.stub :get_traffic_manager_profile, @profile do
      assert_instance_of Fog::TrafficManager::AzureRM::TrafficManagerProfile, @traffic_manager_profiles.get('resource-group-name', 'fog-test-profile-name')
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/models/traffic_manager/test_traffic_manager_profiles.rb
fog-azure-rm-0.1.0 test/models/traffic_manager/test_traffic_manager_profiles.rb
fog-azure-rm-0.0.9 test/models/traffic_manager/test_traffic_manager_profiles.rb