Sha256: d7a423ccf848ba85e3f1e0bd7b4155cf09255e7b3de3b4c3ac1045dcbe8e4674
Contents?: true
Size: 1.57 KB
Versions: 1
Compression:
Stored size: 1.57 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 = ::Fog::Libvirt::Compute::Real.send(:pool_to_attributes, FakePool.new(inactive_pool), true) test("should be hash of attributes") { response.kind_of? Hash } response = ::Fog::Libvirt::Compute::Real.send(:pool_to_attributes, FakePool.new(inactive_pool)) test("should be nil") { response.nil? } end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fog-libvirt-0.10.0 | tests/libvirt/requests/compute/list_pools_tests.rb |