Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse code

[xenserver|tests] added missing SotorageRepository tests

  • Loading branch information...
commit 731ba25bc4cb2d1003f69f81db8ff8f06012e4c1 1 parent 09c8d80
Sergio Rubio authored
26  tests/xenserver/models/compute/storage_repository_tests.rb
@@ -6,6 +6,9 @@
6 6
   tests('The StorageRepository model should') do
7 7
     tests('have the action') do
8 8
       test('reload') { storage_repository.respond_to? 'reload' }
  9
+      test('destroy') { storage_repository.respond_to? 'destroy' }
  10
+      test('scan') { storage_repository.respond_to? 'scan' }
  11
+      test('save') { storage_repository.respond_to? 'save' }
9 12
     end
10 13
     tests('have attributes') do
11 14
       model_attribute_hash = storage_repository.attributes
@@ -25,7 +28,9 @@
25 28
         :tags,
26 29
         :__vdis,
27 30
         :physical_size,
28  
-        :physical_utilisation
  31
+        :physical_utilisation,
  32
+        :virtual_allocation,
  33
+        :sm_config
29 34
       ]
30 35
       tests("The StorageRepository model should respond to") do
31 36
         attributes.each do |attribute|
@@ -60,4 +65,23 @@
60 65
     end
61 66
   end
62 67
 
  68
+  test('#save') do
  69
+    conn = Fog::Compute[:xenserver]
  70
+    sr = conn.storage_repositories.create :name => 'FOG TEST SR',
  71
+                                          :host => conn.hosts.first,
  72
+                                          :type => 'ext',
  73
+                                          :content_type => 'local SR',
  74
+                                          :device_config => { :device => '/dev/sdb' },
  75
+                                          :shared => false
  76
+    !(conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }).nil?
  77
+  end
  78
+
  79
+  test('#destroy') do
  80
+    conn = Fog::Compute[:xenserver]
  81
+    sr = (conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' })
  82
+    sr.pbds.each { |pbd| pbd.unplug }
  83
+    sr.destroy
  84
+    (conn.storage_repositories.find { |sr| sr.name == 'FOG TEST SR' }).nil?
  85
+  end
  86
+
63 87
 end

0 notes on commit 731ba25

Please sign in to comment.
Something went wrong with that request. Please try again.