Sha256: a6467e1537e0d80a245b3f9067805555c79527980f377e499150ba7e3d5b8eaa

Contents?: true

Size: 1.56 KB

Versions: 2

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 @traffic_manager_end_point.respond_to? 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 @traffic_manager_end_point.respond_to? 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

2 entries across 2 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.8 test/models/traffic_manager/test_traffic_manager_end_point.rb
fog-azure-rm-0.0.6 test/models/traffic_manager/test_traffic_manager_end_point.rb