mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
fb54e330b2
* Added missing VDI attributes and methods * added create/destroy request tests * Added valid_ref? test helper * Fixes in get_record_tests
32 lines
1.1 KiB
Ruby
32 lines
1.1 KiB
Ruby
Shindo.tests('Fog::Compute[:xenserver] | clone_server request', ['xenserver']) do
|
|
|
|
compute = Fog::Compute[:xenserver]
|
|
servers = compute.servers
|
|
(servers.all :name_matches => test_ephemeral_vm_name).each do |s|
|
|
s.destroy
|
|
end
|
|
|
|
tests('clone_server should') do
|
|
raises(ArgumentError, 'raise exception when template nil') do
|
|
compute.clone_server 'fooserver', nil
|
|
end
|
|
raises(ArgumentError, 'raise exception when name nil') do
|
|
compute.clone_server nil, 'fooref'
|
|
end
|
|
|
|
compute.default_template = test_template_name
|
|
tmpl = compute.default_template
|
|
test('accept a string template ref') do
|
|
ref = compute.clone_server test_ephemeral_vm_name, tmpl.reference
|
|
(ref =~ /OpaqueRef:/) == 0 and !(servers.custom_templates.find { |s| s.reference == ref }).nil?
|
|
end
|
|
test('accept a Server object') do
|
|
ref = compute.clone_server test_ephemeral_vm_name, tmpl
|
|
(ref =~ /OpaqueRef:/) == 0 and !(servers.custom_templates.find { |s| s.reference == ref }).nil?
|
|
end
|
|
end
|
|
|
|
tests('The expected options') do
|
|
raises(ArgumentError, 'raises ArgumentError when ref,class missing') { compute.clone_server }
|
|
end
|
|
end
|