Sha256: 5bd32c2a9815467cbb96ebfb4fb64b955a612765b6e9267d1af9941be317edb7

Contents?: true

Size: 886 Bytes

Versions: 6

Compression:

Stored size: 886 Bytes

Contents

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

# Test class for Start Virtual Machine Request
class TestStartVirtualMachine < 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_start_virtual_machine_success
    @virtual_machines.stub :start, true do
      assert @service.start_virtual_machine('fog-test-rg', 'fog-test-server')
    end
  end

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
fog-azure-rm-0.1.1 test/requests/compute/test_start_virtual_machine.rb
fog-azure-rm-0.1.0 test/requests/compute/test_start_virtual_machine.rb
fog-azure-rm-0.0.9 test/requests/compute/test_start_virtual_machine.rb
fog-azure-rm-0.0.8 test/requests/compute/test_start_virtual_machine.rb
fog-azure-rm-0.0.6 test/requests/compute/test_start_virtual_machine.rb
fog-azure-rm-0.0.5 test/requests/compute/test_start_virtual_machine.rb