Sha256: bb1c3ef9b8f8bed457d0ce1a7babce854074d39255f73e161921af30500dd5ad

Contents?: true

Size: 1.06 KB

Versions: 18

Compression:

Stored size: 1.06 KB

Contents

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

# Test class for Get Virtual Machine Request
class TestGetVirtualMachineStatus < Minitest::Test
  def setup
    @service = Fog::Compute::AzureRM.new(credentials)
    @compute_client = @service.instance_variable_get(:@compute_mgmt_client)
    @virtual_machines = @compute_client.virtual_machines
  end

  def test_vm_status_success
    response = ApiStub::Requests::Compute::VirtualMachine.virtual_machine_instance_view_response(@compute_client)
    compare_result = ApiStub::Requests::Compute::VirtualMachine.vm_status_response
    @virtual_machines.stub :get, response do
      assert_equal @service.check_vm_status('fog-test-rg', 'fog-test-server', false), compare_result
    end
  end

  def test_vm_status_failure
    response = proc { fail MsRestAzure::AzureOperationError.new(nil, nil, 'error' => { 'message' => 'mocked exception' }) }
    @virtual_machines.stub :get, response do
      assert_raises(RuntimeError) { @service.check_vm_status('fog-test-rg', 'fog-test-server', false) }
    end
  end
end

Version data entries

18 entries across 18 versions & 3 rubygems

Version Path
fog-azure-rm-0.4.5 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-temp-0.0.5 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.4.4 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.4.3 test/requests/compute/test_get_vm_status.rb
far-gem-0.5.1 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.4.2 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.4.1 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.4.0 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.3.9 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.3.8 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.3.7 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.3.6 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.3.5 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.3.4 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-temp-0.0.4 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-temp-0.0.3 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-0.3.3 test/requests/compute/test_get_vm_status.rb
fog-azure-rm-temp-0.0.2 test/requests/compute/test_get_vm_status.rb