Sha256: e99bb43d625a1faa33526c06bf18440c0567bedbfae3a3f9cbb12b82c0df9a51

Contents?: true

Size: 1.83 KB

Versions: 2

Compression:

Stored size: 1.83 KB

Contents

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

# Test class for Traffic Manager Profile Model
class TestTrafficManagerProfile < Minitest::Test
  def setup
    @service = Fog::TrafficManager::AzureRM.new(credentials)
    @traffic_manager_profile = traffic_manager_profile(@service)
    @traffic_manager_client = @service.instance_variable_get(:@traffic_mgmt_client)
    @traffic_manager_profile_response = ApiStub::Models::TrafficManager::TrafficManagerProfile.traffic_manager_profile_response(@traffic_manager_client)
  end

  def test_model_methods
    methods = [
      :save,
      :destroy,
      :update
    ]
    methods.each do |method|
      assert @traffic_manager_profile.respond_to? method
    end
  end

  def test_model_attributes
    attributes = [
      :name,
      :id,
      :resource_group,
      :location,
      :profile_status,
      :traffic_routing_method,
      :relative_name,
      :fqdn,
      :ttl,
      :profile_monitor_status,
      :protocol,
      :port,
      :path,
      :endpoints
    ]
    attributes.each do |attribute|
      assert @traffic_manager_profile.respond_to? attribute
    end
  end

  def test_save_method_response
    @service.stub :create_or_update_traffic_manager_profile, @traffic_manager_profile_response do
      assert_instance_of Fog::TrafficManager::AzureRM::TrafficManagerProfile, @traffic_manager_profile.save
    end
  end

  def test_update_method_response
    @service.stub :create_or_update_traffic_manager_profile, @traffic_manager_profile_response do
      assert_instance_of Fog::TrafficManager::AzureRM::TrafficManagerProfile, @traffic_manager_profile.update({})
    end
  end

  def test_destroy_method_response
    @service.stub :delete_traffic_manager_profile, true do
      assert @traffic_manager_profile.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_profile.rb
fog-azure-rm-0.0.6 test/models/traffic_manager/test_traffic_manager_profile.rb