Sha256: f0e360e614a0f56f9e62e7ec9f127e5e68567f767a8a4b2a0f26b4a720150f42

Contents?: true

Size: 1.31 KB

Versions: 3

Compression:

Stored size: 1.31 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)
    network_client = @service.instance_variable_get(:@network_client)
    @response = ApiStub::Models::Network::LoadBalancer.create_load_balancer_response(network_client)
  end

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

  def test_model_attributes
    attributes = [
      :name,
      :id,
      :location,
      :resource_group,
      :frontend_ip_configurations,
      :backend_address_pool_names,
      :load_balancing_rules,
      :probes,
      :inbound_nat_rules,
      :inbound_nat_pools
    ]
    attributes.each do |attribute|
      assert @load_balancer.respond_to? attribute
    end
  end

  def test_save_method_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

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.0.8 test/models/network/test_load_balancer.rb
fog-azure-rm-0.0.6 test/models/network/test_load_balancer.rb
fog-azure-rm-0.0.5 test/models/network/test_load_balancer.rb