summaryrefslogtreecommitdiffstats
path: root/spec/shared_behaviours
diff options
context:
space:
mode:
authorLuke Kanies <luke@madstop.com>2008-07-29 00:46:11 -0500
committerLuke Kanies <luke@madstop.com>2008-07-29 00:46:11 -0500
commit40375a8fc34dbd85d87f507ba72c7394b25b7271 (patch)
treeefd5a93980b042b73322bd31e6fdb41203d07576 /spec/shared_behaviours
parent93eeff59d807261ed154cc104e318ae604602430 (diff)
parent8f5800f0608dff46407cb5f23ee73f314fe051e8 (diff)
downloadpuppet-40375a8fc34dbd85d87f507ba72c7394b25b7271.tar.gz
puppet-40375a8fc34dbd85d87f507ba72c7394b25b7271.tar.xz
puppet-40375a8fc34dbd85d87f507ba72c7394b25b7271.zip
Merge branch '0.24.x' into merging
Conflicts: test/ral/type/filesources.rb
Diffstat (limited to 'spec/shared_behaviours')
-rw-r--r--spec/shared_behaviours/file_server_terminus.rb4
-rw-r--r--spec/shared_behaviours/file_serving.rb22
2 files changed, 19 insertions, 7 deletions
diff --git a/spec/shared_behaviours/file_server_terminus.rb b/spec/shared_behaviours/file_server_terminus.rb
index 883db58f5..0230d39e8 100644
--- a/spec/shared_behaviours/file_server_terminus.rb
+++ b/spec/shared_behaviours/file_server_terminus.rb
@@ -24,6 +24,8 @@ describe "Puppet::Indirector::FileServerTerminus", :shared => true do
# Stub out the modules terminus
@modules = mock 'modules terminus'
+
+ @request = Puppet::Indirector::Request.new(:indirection, :method, "puppetmounts://myhost/one/my/file")
end
it "should use the file server configuration to find files" do
@@ -35,6 +37,6 @@ describe "Puppet::Indirector::FileServerTerminus", :shared => true do
FileTest.stubs(:exists?).with("/my/mount/path").returns(true)
@mount1.expects(:file).with("my/file", :node => nil).returns(path)
- @terminus.find("puppetmounts://myhost/one/my/file").should be_instance_of(@test_class)
+ @terminus.find(@request).should be_instance_of(@test_class)
end
end
diff --git a/spec/shared_behaviours/file_serving.rb b/spec/shared_behaviours/file_serving.rb
index 82f207243..ba01f75a1 100644
--- a/spec/shared_behaviours/file_serving.rb
+++ b/spec/shared_behaviours/file_serving.rb
@@ -5,13 +5,13 @@
describe "Puppet::FileServing::Files", :shared => true do
it "should use the rest terminus when the 'puppet' URI scheme is used and a host name is present" do
- uri = "puppet://myhost/mymod/my/file"
+ uri = "puppet://myhost/fakemod/my/file"
@indirection.terminus(:rest).expects(:find)
@test_class.find(uri)
end
it "should use the rest terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is not 'puppet'" do
- uri = "puppet:///mymod/my/file"
+ uri = "puppet:///fakemod/my/file"
Puppet.settings.stubs(:value).with(:name).returns("puppetd")
Puppet.settings.stubs(:value).with(:modulepath).returns("")
@indirection.terminus(:rest).expects(:find)
@@ -19,7 +19,7 @@ describe "Puppet::FileServing::Files", :shared => true do
end
it "should use the file_server terminus when the 'puppet' URI scheme is used, no host name is present, and the process name is 'puppet'" do
- uri = "puppet:///mymod/my/file"
+ uri = "puppet:///fakemod/my/file"
Puppet::Node::Environment.stubs(:new).returns(stub("env", :name => "testing"))
Puppet.settings.stubs(:value).with(:name).returns("puppet")
Puppet.settings.stubs(:value).with(:modulepath, "testing").returns("")
@@ -33,22 +33,32 @@ describe "Puppet::FileServing::Files", :shared => true do
end
it "should use the file_server terminus when the 'puppetmounts' URI scheme is used" do
- uri = "puppetmounts:///mymod/my/file"
+ uri = "puppetmounts:///fakemod/my/file"
@indirection.terminus(:file_server).expects(:find)
@indirection.terminus(:file_server).stubs(:authorized?).returns(true)
@test_class.find(uri)
end
it "should use the file terminus when the 'file' URI scheme is used" do
- uri = "file:///mymod/my/file"
+ uri = "file:///fakemod/my/file"
@indirection.terminus(:file).expects(:find)
@test_class.find(uri)
end
it "should use the file terminus when a fully qualified path is provided" do
- uri = "/mymod/my/file"
+ uri = "/fakemod/my/file"
@indirection.terminus(:file).expects(:find)
@test_class.find(uri)
end
+
+ it "should use the configuration to test whether the request is allowed" do
+ uri = "puppetmounts:///fakemod/my/file"
+ config = mock 'configuration'
+ @indirection.terminus(:file_server).stubs(:configuration).returns config
+
+ @indirection.terminus(:file_server).expects(:find)
+ config.expects(:authorized?).returns(true)
+ @test_class.find(uri, :node => "foo", :ip => "bar")
+ end
end