Sha256: 52de30f9b627a999b1c457198f92742f6d58b1e8c7121da0337bb657a01c916f

Contents?: true

Size: 1.52 KB

Versions: 1

Compression:

Stored size: 1.52 KB

Contents

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

# Test class for LoadBalancer Model
class TestLoadBalancer < Minitest::Test
  def setup
    @service = Fog::Network::AzureRM.new(credentials)
    @load_balancer = load_balancer(@service)
  end

  def test_model_methods
    response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response
    methods = [
      :save,
      :destroy
    ]
    @service.stub :create_load_balancer, response do
      methods.each do |method|
        assert @load_balancer.respond_to? method
      end
    end
  end

  def test_model_attributes
    response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response
    attributes = [
      :name,
      :id,
      :location,
      :resource_group,
      :frontend_ip_configurations,
      :backend_address_pool_names,
      :load_balancing_rules,
      :probes,
      :inbound_nat_rules,
      :inbound_nat_pools
    ]
    @service.stub :create_load_balancer, response do
      attributes.each do |attribute|
        assert @load_balancer.respond_to? attribute
      end
    end
  end

  def test_save_method_response
    response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response
    @service.stub :create_load_balancer, response do
      assert_instance_of Fog::Network::AzureRM::LoadBalancer, @load_balancer.save
    end
  end

  def test_destroy_method_response
    @service.stub :delete_load_balancer, true do
      assert @load_balancer.destroy
    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_load_balancer.rb