Sha256: e3e990b5daeb8d6566002fd014b8c71fc34041447937a0a41bae52ee4ea78199

Contents?: true

Size: 1.89 KB

Versions: 47

Compression:

Stored size: 1.89 KB

Contents

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

# Test class for VirtualMachineExtension Model
class TestVirtualMachineExtension < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    @virtual_machine_extension = virtual_machine_extension(@service)
    @compute_client = @service.instance_variable_get(:@compute_mgmt_client)
  end

  def test_model_methods
    methods = [
      :save,
      :update,
      :destroy
    ]
    methods.each do |method|
      assert_respond_to @virtual_machine_extension, method
    end
  end

  def test_model_attributes
    attributes = [
      :id,
      :name,
      :resource_group,
      :location,
      :vm_name,
      :type,
      :publisher,
      :type_handler_version,
      :auto_upgrade_minor_version,
      :settings,
      :protected_settings
    ]
    attributes.each do |attribute|
      assert_respond_to @virtual_machine_extension, attribute
    end
  end

  def test_save_method_response
    response = ApiStub::Models::Compute::VirtualMachineExtension.create_vm_extension_response(@compute_client)
    @service.stub :create_or_update_vm_extension, response do
      assert_instance_of Fog::Compute::AzureRM::VirtualMachineExtension, @virtual_machine_extension.save
    end
  end

  def test_update_method_response
    response = ApiStub::Models::Compute::VirtualMachineExtension.create_vm_extension_response(@compute_client)
    @service.stub :create_or_update_vm_extension, response do
      assert_instance_of Fog::Compute::AzureRM::VirtualMachineExtension, @virtual_machine_extension.update({})
    end
  end

  def test_destroy_method_response
    response = MsRestAzure::AzureOperationResponse.new(MsRest::HttpOperationRequest.new('', '', ''), Faraday::Response.new)
    @service.stub :delete_vm_extension, response do
      assert_instance_of MsRestAzure::AzureOperationResponse, @virtual_machine_extension.destroy
    end
  end
end

Version data entries

47 entries across 47 versions & 4 rubygems

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