Sha256: 833f1a9008fe63ecc36b9524303edfa4f6ff0f777a629d96f7e781bc3f163275
Contents?: true
Size: 1.53 KB
Versions: 5
Compression:
Stored size: 1.53 KB
Contents
class FakePool < Fog::Model # Fake pool object to allow exercising the internal parsing of pools # returned by the client queries identity :uuid attribute :persistent attribute :autostart attribute :active attribute :name attribute :num_of_volumes attr_reader :info class FakeInfo < Fog::Model attribute :allocation attribute :capacity attribute :state end def initialize(attributes = {}) @info = FakeInfo.new(attributes.dup.delete(:info)) super(attributes) end def active? active end def autostart? autostart end def persistent? persistent end end Shindo.tests("Fog::Compute[:libvirt] | list_pools request", 'libvirt') do compute = Fog::Compute[:libvirt] tests("Lists Pools") do response = compute.list_pools test("should be an array") { response.kind_of? Array } test("should have two pools") { response.length == 2 } end tests("Handle Inactive Pools") do inactive_pool = { :uuid => 'pool.uuid', :persistent => true, :autostart => true, :active => false, :name => 'inactive_pool1', :info => { :allocation => 123456789, :capacity => 123456789, :state => 2 # running }, :num_of_volumes => 3 } response = compute.send(:pool_to_attributes, FakePool.new(inactive_pool), true) test("should be hash of attributes") { response.kind_of? Hash } response = compute.send(:pool_to_attributes, FakePool.new(inactive_pool)) test("should be nil") { response.nil? } end end
Version data entries
5 entries across 5 versions & 1 rubygems