Sha256: 516a2183cb0cf0e4b244ea08ff6b899c3d5b8b696aaeae61ded34735260e6f24

Contents?: true

Size: 1.45 KB

Versions: 17

Compression:

Stored size: 1.45 KB

Contents

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

# Test class for Managed Disk Model
class TestManagedDisk < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    @managed_disk = managed_disk(@service)
    compute_client = @service.instance_variable_get(:@compute_mgmt_client)
    @response = ApiStub::Models::Compute::ManagedDisk.create_managed_disk_response(compute_client)
  end

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

  def test_model_attributes
    attributes = [
      :id,
      :name,
      :type,
      :location,
      :resource_group_name,
      :account_type,
      :time_created,
      :os_type,
      :disk_size_gb,
      :owner_id,
      :provisioning_state,
      :tags,
      :creation_data,
      :encryption_settings,
      :tags
    ]
    attributes.each do |attribute|
      assert_respond_to @managed_disk, attribute
    end
  end

  def test_save_method_response
    @service.stub :create_or_update_managed_disk, @response do
      assert_instance_of Fog::Compute::AzureRM::ManagedDisk, @managed_disk.save
    end
  end

  def test_destroy_method_true_response
    @service.stub :delete_managed_disk, true do
      assert @managed_disk.destroy
    end
  end

  def test_destroy_method_false_response
    @service.stub :delete_managed_disk, false do
      assert !@managed_disk.destroy
    end
  end
end

Version data entries

17 entries across 17 versions & 3 rubygems

Version Path
fog-azure-rm-0.4.8 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.4.7 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.4.6 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.4.5 test/models/compute/test_managed_disk.rb
fog-azure-rm-temp-0.0.5 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.4.4 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.4.3 test/models/compute/test_managed_disk.rb
far-gem-0.5.1 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.4.2 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.4.1 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.4.0 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.3.9 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.3.8 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.3.7 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.3.6 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.3.5 test/models/compute/test_managed_disk.rb
fog-azure-rm-0.3.4 test/models/compute/test_managed_disk.rb