From 731ba25bc4cb2d1003f69f81db8ff8f06012e4c1 Mon Sep 17 00:00:00 2001 From: Sergio Rubio Date: Fri, 4 Jan 2013 23:18:31 +0100 Subject: [PATCH] [xenserver|tests] added missing SotorageRepository tests --- .../compute/storage_repository_tests.rb | 26 ++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/tests/xenserver/models/compute/storage_repository_tests.rb b/tests/xenserver/models/compute/storage_repository_tests.rb index 4cfbd4d65..0d09551f9 100644 --- a/tests/xenserver/models/compute/storage_repository_tests.rb +++ b/tests/xenserver/models/compute/storage_repository_tests.rb @@ -6,6 +6,9 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepository model', ['xenserver'] tests('The StorageRepository model should') do tests('have the action') do test('reload') { storage_repository.respond_to? 'reload' } + test('destroy') { storage_repository.respond_to? 'destroy' } + test('scan') { storage_repository.respond_to? 'scan' } + test('save') { storage_repository.respond_to? 'save' } end tests('have attributes') do model_attribute_hash = storage_repository.attributes @@ -25,7 +28,9 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepository model', ['xenserver'] :tags, :__vdis, :physical_size, - :physical_utilisation + :physical_utilisation, + :virtual_allocation, + :sm_config ] tests("The StorageRepository model should respond to") do attributes.each do |attribute| @@ -60,4 +65,23 @@ Shindo.tests('Fog::Compute[:xenserver] | StorageRepository model', ['xenserver'] end end + test('#save') do + conn = Fog::Compute[:xenserver] + sr = conn.storage_repositories.create :name => 'FOG TEST SR', + :host => conn.hosts.first, + :type => 'ext', + :content_type => 'local SR', + :device_config => { :device => '/dev/sdb' }, + :shared => false + !(conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }).nil? + end + + test('#destroy') do + conn = Fog::Compute[:xenserver] + sr = (conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }) + sr.pbds.each { |pbd| pbd.unplug } + sr.destroy + (conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }).nil? + end + end