Sha256: bff41813819d66de5686b7c76809b870debb0ad5e31df1ae7c2c50cb2fc2ac28

Contents?: true

Size: 1.43 KB

Versions: 10

Compression:

Stored size: 1.43 KB

Contents

#!/usr/bin/env rspec

require 'spec_helper'

require File.dirname(__FILE__) + "/../../../../../plugins/mcollective/data/agent_data.rb"

module MCollective
  module Data
    describe Agent_data do
      describe "#query_data" do
        before do
          @ddl = mock
          @ddl.stubs(:dataquery_interface).returns({:output => {}})
          @ddl.stubs(:meta).returns({:timeout => 1})
          DDL.stubs(:new).returns(@ddl)
          @plugin = Agent_data.new
        end

        it "should fail for unknown agents" do
          expect { @plugin.query_data("rspec") }.to raise_error("No agent called rspec found")
        end

        it "should retrieve the correct agent and data" do
          agent = mock
          agent.stubs(:meta).returns({:license => "license",
                                        :timeout => "timeout",
                                        :description => "description",
                                        :url => "url",
                                        :version => "version",
                                        :author => "author"})

          PluginManager.stubs(:[]).with("rspec_agent").returns(agent)
          PluginManager.expects(:include?).with("rspec_agent").returns(true)

          @plugin.query_data("rspec")

          [:license, :timeout, :description, :url, :version, :author].each do |item|
            @plugin.result[item].should == item.to_s
          end
        end
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
mcollective-client-2.7.0 spec/unit/plugins/mcollective/data/agent_data_spec.rb
mcollective-client-2.6.1 spec/unit/plugins/mcollective/data/agent_data_spec.rb
mcollective-client-2.6.0 spec/unit/plugins/mcollective/data/agent_data_spec.rb
mcollective-client-2.5.3 spec/unit/plugins/mcollective/data/agent_data_spec.rb
mcollective-client-2.5.2 spec/unit/plugins/mcollective/data/agent_data_spec.rb
mcollective-client-2.5.1 spec/unit/plugins/mcollective/data/agent_data_spec.rb
mcollective-client-2.5.0 spec/unit/plugins/mcollective/data/agent_data_spec.rb
mcollective-client-2.5.0.rc1 spec/unit/plugins/mcollective/data/agent_data_spec.rb
mcollective-client-2.4.1 spec/unit/plugins/mcollective/data/agent_data_spec.rb
mcollective-client-2.4.0 spec/unit/plugins/mcollective/data/agent_data_spec.rb