Sha256: 0f09a9b9a8a8006e64eee4d4a17d8919ada6b8f425d83326d43743395643186c
Contents?: true
Size: 1.51 KB
Versions: 2
Compression:
Stored size: 1.51 KB
Contents
require 'test/helper' describe "Runpuppet::Agent" do before do @ctx = Dim::Container.new(TestContext) @agent = @ctx.agent end describe :check_status do it "returns the action for puppet and branch" do @agent.stubs(:get).returns('run-master') @agent.check_status.must_equal ["run", "master"] end it "returns nil for errors" do @agent.stubs(:get).raises(RuntimeError) @agent.check_status.must_be_nil end end describe :base_url do it 'works' do @agent.base_url('/action').must_equal "http://user:pass@puppet.example.com/action" end end describe "URL manipulation" do before do @ctx.config.stubs(:local_ip).returns('10.10.10.10') @ctx.config.stubs(:hostname).returns('example-vm') end describe :append_params_to_post do it "adds hostname and local ip to params" do params = {} new_params = @agent.append_params_to_post(params) new_params[:hostname].must_equal 'example-vm' new_params[:ip].must_equal '10.10.10.10' end end describe :append_params_to_url do it "adds ip and hostname to url" do new_url = @agent.append_params_to_url('/action') new_url.must_equal "/action?hostname=example-vm&ip=10.10.10.10" end it "appends to existing params, if needed" do new_url = @agent.append_params_to_url('/action?some_funny_param=1') new_url.must_equal "/action?some_funny_param=1&hostname=example-vm&ip=10.10.10.10" end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
runpuppet-1.0.2 | test/agent_test.rb |
runpuppet-1.0.1 | test/agent_test.rb |