Sha256: 07fbe20b81faf375df35d3ac2a7ce74b97b8d3e4e7278c28e46285dde7e9e99a

Contents?: true

Size: 1.46 KB

Versions: 1

Compression:

Stored size: 1.46 KB

Contents

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

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

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

  def test_collection_attributes
    assert @traffic_manager_profiles.respond_to? :resource_group
  end

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

  def test_get_method_response
    @service.stub :list_traffic_manager_profiles, @response do
      assert_instance_of Fog::Network::AzureRM::TrafficManagerProfile, @traffic_manager_profiles.get('fog-test-profile')
      assert @traffic_manager_profiles.get('wrong-name').nil?
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.4 test/models/network/test_traffic_manager_profiles.rb