Sha256: 9de814e23ac165b136f18b54eff9fe854126432ba59df53cb2eb8e51f4ca48c8

Contents?: true

Size: 1.95 KB

Versions: 3

Compression:

Stored size: 1.95 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

3 entries across 3 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/models/compute/test_virtual_machine_extension.rb
fog-azure-rm-0.1.0 test/models/compute/test_virtual_machine_extension.rb
fog-azure-rm-0.0.9 test/models/compute/test_virtual_machine_extension.rb