test/models/compute/test_server.rb in fog-azure-rm-0.0.4 vs test/models/compute/test_server.rb in fog-azure-rm-0.0.5
- old
+ new
@@ -3,10 +3,11 @@
# Test class for Server Model
class TestServer < Minitest::Test
def setup
@service = Fog::Compute::AzureRM.new(credentials)
@server = server(@service)
+ @compute_client = @service.instance_variable_get(:@compute_mgmt_client)
end
def test_model_methods
methods = [
:save,
@@ -56,18 +57,18 @@
assert @server.respond_to? attribute, true
end
end
def test_save_method_response_for_linux_vm
- response = ApiStub::Models::Compute::Server.create_linux_virtual_machine_response
+ response = ApiStub::Models::Compute::Server.create_linux_virtual_machine_response(@compute_client)
@service.stub :create_virtual_machine, response do
assert_instance_of Fog::Compute::AzureRM::Server, @server.save
end
end
def test_save_method_response_for_windows_vm
- response = ApiStub::Models::Compute::Server.create_windows_virtual_machine_response
+ response = ApiStub::Models::Compute::Server.create_windows_virtual_machine_response(@compute_client)
@service.stub :create_virtual_machine, response do
assert_instance_of Fog::Compute::AzureRM::Server, @server.save
refute @server.save.disable_password_authentication
end
end
@@ -119,24 +120,24 @@
assert_equal @server.vm_status, 'running'
end
end
def test_list_available_sizes_method_response
- response = ApiStub::Models::Compute::Server.list_available_sizes_for_virtual_machine_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
end
end
def test_attach_data_disk_response
- response = ApiStub::Models::Compute::Server.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
end
def test_detach_data_disk_response
- response = ApiStub::Models::Compute::Server.create_linux_virtual_machine_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
end
end