test/models/compute/test_server.rb in fog-azure-rm-0.3.1 vs test/models/compute/test_server.rb in fog-azure-rm-0.3.2

- old
+ new

@@ -82,46 +82,81 @@ def test_destroy_method_response @service.stub :delete_virtual_machine, true do assert @server.destroy end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :delete_virtual_machine, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.destroy(true) + end end def test_generalize_method_response @service.stub :generalize_virtual_machine, true do assert @server.generalize end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :generalize_virtual_machine, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.generalize(true) + end end def test_power_off_method_response @service.stub :power_off_virtual_machine, true do assert @server.power_off end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :power_off_virtual_machine, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.power_off(true) + end end def test_start_method_response @service.stub :start_virtual_machine, true do assert @server.start end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :start_virtual_machine, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.start(true) + end end def test_restart_method_response @service.stub :restart_virtual_machine, true do assert @server.restart end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :restart_virtual_machine, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.restart(true) + end end def test_deallocate_method_response @service.stub :deallocate_virtual_machine, true do assert @server.deallocate end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :deallocate_virtual_machine, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.deallocate(true) + end end def test_redeploy_method_response @service.stub :redeploy_virtual_machine, true do assert @server.redeploy end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :redeploy_virtual_machine, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.redeploy(true) + end end def test_vm_status_method_response @service.stub :check_vm_status, 'running' do assert_equal @server.vm_status, 'running' @@ -129,23 +164,38 @@ end def test_list_available_sizes_method_response response = ApiStub::Models::Compute::Server.list_available_sizes_for_virtual_machine_response(@compute_client) @service.stub :list_available_sizes_for_virtual_machine, response do - assert_instance_of Array, @server.list_available_sizes + assert_instance_of Array, @server.list_available_sizes(false) end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :list_available_sizes_for_virtual_machine, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.list_available_sizes(true) + end end def test_attach_data_disk_response response = ApiStub::Models::Compute::Server.attach_data_disk_response(@compute_client) @service.stub :attach_data_disk_to_vm, response do assert_instance_of Fog::Compute::AzureRM::Server, @server.attach_data_disk('disk1', '10', 'mystorage1') end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :attach_data_disk_to_vm, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.attach_data_disk('disk', '10', 'mystorage1', true) + end end def test_detach_data_disk_response response = ApiStub::Models::Compute::Server.create_linux_virtual_machine_response(@compute_client) @service.stub :detach_data_disk_from_vm, response do assert_instance_of Fog::Compute::AzureRM::Server, @server.detach_data_disk('disk1') + end + + async_response = Concurrent::Promise.execute { 10 } + @service.stub :detach_data_disk_from_vm, async_response do + assert_instance_of Fog::AzureRM::AsyncResponse, @server.detach_data_disk('disk1', true) end end end