From a1c45790f6cac265a7bac7d63bfb8a3204ed228f Mon Sep 17 00:00:00 2001 From: Rick Bradley Date: Wed, 12 Mar 2008 23:26:05 -0500 Subject: a trivial integration test to test whether the RESTful indirection terminus has a remote shot at working; will need to be upgraded to actually be useful --- spec/integration/indirector/rest.rb | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 spec/integration/indirector/rest.rb (limited to 'spec/integration/indirector/rest.rb') diff --git a/spec/integration/indirector/rest.rb b/spec/integration/indirector/rest.rb new file mode 100644 index 000000000..a8c6f5609 --- /dev/null +++ b/spec/integration/indirector/rest.rb @@ -0,0 +1,35 @@ +require File.dirname(__FILE__) + '/../../spec_helper' +require 'puppet/network/server' +require 'puppet/indirector' +require 'puppet/indirector/rest' + +class Puppet::TestIndirectedFoo + extend Puppet::Indirector + indirects :test_indirected_foo, :terminus_setting => :test_indirected_foo_terminus + + def initialize(foo) + STDERR.puts "foo!" + end +end + +class Puppet::TestIndirectedFoo::Rest < Puppet::Indirector::REST +end + +describe Puppet::Indirector::REST do + before :each do + Puppet::Indirector::Terminus.stubs(:terminus_class).returns(Puppet::TestIndirectedFoo::Rest) + Puppet::TestIndirectedFoo.terminus_class = :rest + Puppet[:servertype] = 'mongrel' + @params = { :address => "127.0.0.1", :port => 34346, :handlers => [ :test_indirected_foo ] } + @server = Puppet::Network::Server.new(@params) + @server.listen + end + + it "should not fail to find an instance over REST" do + lambda { Puppet::TestIndirectedFoo.find('bar') }.should_not raise_error + end + + after :each do + @server.unlisten + end +end \ No newline at end of file -- cgit