Sha256: 020a8fefe7eae54debff57b1e10da34d9b23cba87b39a7445957abe9d8147912
Contents?: true
Size: 1.71 KB
Versions: 14
Compression:
Stored size: 1.71 KB
Contents
require File.expand_path '../../test_helper', __dir__ # Test class for Check Virtual Machine Exists Request class TestCheckVirtualMachineExists < 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_check_vm_exists_success response = ApiStub::Requests::Compute::VirtualMachine.create_virtual_machine_response(@compute_client) @virtual_machines.stub :get, response do assert @service.check_vm_exists('fog-test-rg', 'fog-test-server', false) end end def test_check_vm_exists_failure response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceNotFound' }) } @virtual_machines.stub :get, response do assert !@service.check_vm_exists('fog-test-rg', 'fog-test-server', false) end end def test_check_vm_resource_group_exists_failure response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'ResourceGroupNotFound' }) } @virtual_machines.stub :get, response do assert !@service.check_vm_exists('fog-test-rg', 'fog-test-server', false) end end def test_check_vm_exists_exception response = proc { raise MsRestAzure::AzureOperationError.new(nil, create_mock_response, 'error' => { 'message' => 'mocked exception', 'code' => 'Exception' }) } @virtual_machines.stub :get, response do assert_raises(MsRestAzure::AzureOperationError) { @service.check_vm_exists('fog-test-rg', 'fog-test-server', false) } end end end
Version data entries
14 entries across 14 versions & 2 rubygems