diff options
Diffstat (limited to 'spec/shared_behaviours/file_serving.rb')
-rw-r--r-- | spec/shared_behaviours/file_serving.rb | 22 |
1 files changed, 16 insertions, 6 deletions
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 |