Sha256: 3467899b8d18e1f8956b687d449a008629419cdc8caff3dcc41a76074e549e00

Contents?: true

Size: 1.55 KB

Versions: 46

Compression:

Stored size: 1.55 KB

Contents

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

class TestVirtualMachineExtensions < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    @vm_extensions = Fog::Compute::AzureRM::VirtualMachineExtensions.new(resource_group: 'fog-test-rg', service: @service)
    @compute_client = @service.instance_variable_get(:@compute_mgmt_client)
    @response = ApiStub::Models::Compute::VirtualMachineExtension.create_vm_extension_response(@compute_client)
  end

  def test_collection_methods
    methods = [
      :all,
      :get,
      :check_vm_extension_exists
    ]
    methods.each do |method|
      assert_respond_to @vm_extensions, method
    end
  end

  def test_collection_attributes
    attributes = [
      :resource_group,
      :vm_name
    ]
    attributes.each do |attribute|
      assert_respond_to @vm_extensions, attribute
    end
  end

  def test_get_method_response
    @service.stub :get_vm_extension, @response do
      assert_instance_of Fog::Compute::AzureRM::VirtualMachineExtension, @vm_extensions.get('fog-test-rg', 'fog-test-server', 'fog-test-extension')
    end
  end

  def test_check_vm_extension_exists_true_case
    @service.stub :check_vm_extension_exists, true do
      assert @vm_extensions.check_vm_extension_exists('fog-test-rg', 'fog-test-server', 'fog-test-extension')
    end
  end

  def test_check_vm_extension_exists_false_case
    @service.stub :check_vm_extension_exists, false do
      assert !@vm_extensions.check_vm_extension_exists('fog-test-rg', 'fog-test-server', 'fog-test-extension')
    end
  end
end

Version data entries

46 entries across 46 versions & 4 rubygems

Version Path
fog-azure-rm-0.6.0 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.5.3 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.5.2 test/models/compute/test_virtual_machine_extensions.rb
far-gem-0.5.6 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.5.1 test/models/compute/test_virtual_machine_extensions.rb
far-gem-0.5.5 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.5.0 test/models/compute/test_virtual_machine_extensions.rb
far-gem-0.5.4 test/models/compute/test_virtual_machine_extensions.rb
far-gem-0.5.3 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.4.9 test/models/compute/test_virtual_machine_extensions.rb
far-gem-0.5.2 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.4.8 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.4.7 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.4.6 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.4.5 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-temp-0.0.5 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.4.4 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.4.3 test/models/compute/test_virtual_machine_extensions.rb
far-gem-0.5.1 test/models/compute/test_virtual_machine_extensions.rb
fog-azure-rm-0.4.2 test/models/compute/test_virtual_machine_extensions.rb