Sha256: 46e056e809b09910f9b842fc96791102139f65f9f59db556b29d17f6b4782bd5

Contents?: true

Size: 1.56 KB

Versions: 3

Compression:

Stored size: 1.56 KB

Contents

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

# Test class for Traffic Manager End Point Model
class TestTrafficManagerEndPoint < Minitest::Test
  def setup
    @service = Fog::TrafficManager::AzureRM.new(credentials)
    @traffic_manager_end_point = traffic_manager_end_point(@service)
    @traffic_manager_client = @service.instance_variable_get(:@traffic_mgmt_client)
  end

  def test_model_methods
    methods = [
      :save,
      :destroy
    ]
    methods.each do |method|
      assert_respond_to @traffic_manager_end_point, method
    end
  end

  def test_model_attributes
    attributes = [
      :name,
      :traffic_manager_profile_name,
      :id,
      :resource_group,
      :type,
      :target_resource_id,
      :target,
      :endpoint_status,
      :endpoint_monitor_status,
      :weight,
      :priority,
      :endpoint_location,
      :min_child_endpoints
    ]
    attributes.each do |attribute|
      assert_respond_to @traffic_manager_end_point, attribute
    end
  end

  def test_save_method_response
    response = ApiStub::Models::TrafficManager::TrafficManagerEndPoint.create_traffic_manager_end_point_response(@traffic_manager_client)
    @service.stub :create_or_update_traffic_manager_endpoint, response do
      assert_instance_of Fog::TrafficManager::AzureRM::TrafficManagerEndPoint, @traffic_manager_end_point.save
    end
  end

  def test_destroy_method_response
    @service.stub :delete_traffic_manager_endpoint, true do
      assert @traffic_manager_end_point.destroy
    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_end_point.rb
fog-azure-rm-0.1.0 test/models/traffic_manager/test_traffic_manager_end_point.rb
fog-azure-rm-0.0.9 test/models/traffic_manager/test_traffic_manager_end_point.rb