1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/xenserver/requests/compute/create_vdi_tests.rb
Sergio Rubio d7edfcd443 * Added missing attributes to Server model
* Added create_server_raw request and tests
* Added VIF.save action
* more tests
2012-04-13 12:44:49 +02:00

80 lines
2.4 KiB
Ruby

Shindo.tests('Fog::Compute[:xenserver] | create_vdi request', ['xenserver']) do
compute = Fog::Compute[:xenserver]
sr = compute.storage_repositories.find { |sr| sr.name == 'Local storage' }
tests('create_vdi should') do
raises(ArgumentError, 'raise ArgumentError if virtual_size is no specified') do
ref = compute.create_vdi( {
:storage_repository => sr,
:name => 'foovdi',
:type => 'system',
:read_only => false,
:sharable => false,
:other_config => {}
} )
end
raises(ArgumentError, 'raise ArgumentError if type is no specified') do
ref = compute.create_vdi( {
:storage_repository => sr,
:name => 'foovdi',
:virtual_size => '8589934592',
:read_only => false,
:sharable => false,
:other_config => {}
} )
valid_ref? ref
end
raises(ArgumentError, 'raise ArgumentError if read_only is no specified') do
ref = compute.create_vdi( {
:storage_repository => sr,
:name => 'foovdi',
:virtual_size => '8589934592',
:type => 'system',
:sharable => false,
:other_config => {}
} )
valid_ref? ref
end
raises(ArgumentError, 'raise ArgumentError if sharable is no specified') do
ref = compute.create_vdi( {
:storage_repository => sr,
:name => 'foovdi',
:virtual_size => '8589934592',
:type => 'system',
:read_only => false,
:other_config => {}
} )
valid_ref? ref
end
raises(ArgumentError, 'raise ArgumentError if other_config is no specified') do
ref = compute.create_vdi( {
:storage_repository => sr,
:name => 'foovdi',
:virtual_size => '8589934592',
:type => 'system',
:read_only => false,
:sharable => false,
} )
valid_ref? ref
end
test('create a VDI') do
ref = compute.create_vdi( {
:storage_repository => sr,
:name => 'foovdi',
:virtual_size => '8589934592',
:type => 'system',
:read_only => false,
:sharable => false,
:other_config => {}
} )
valid_ref? ref
end
end
compute.vdis.each { |vdi| vdi.destroy if vdi.name == 'foovdi' }
tests('The expected options') do
raises(ArgumentError, 'raises ArgumentError when vm_ref,net_ref missing') { compute.create_vdi }
end
end