diff options
author | Paul Nasrat <pnasrat@googlemail.com> | 2008-09-19 11:41:45 +0100 |
---|---|---|
committer | James Turnbull <james@lovedthanlost.net> | 2008-09-30 22:21:49 +1000 |
commit | af8c70650b028a70ed50ac6c2bd7f4f00c17ae03 (patch) | |
tree | 0a64e59476b9f3d285731875ec57fba69b818785 /spec/unit/file_serving | |
parent | 860bdb120df93c3ad9f323529f22f71ca8548cf8 (diff) | |
download | puppet-af8c70650b028a70ed50ac6c2bd7f4f00c17ae03.tar.gz puppet-af8c70650b028a70ed50ac6c2bd7f4f00c17ae03.tar.xz puppet-af8c70650b028a70ed50ac6c2bd7f4f00c17ae03.zip |
Fix metadata class for cases when checksum_type set
Diffstat (limited to 'spec/unit/file_serving')
-rwxr-xr-x | spec/unit/file_serving/metadata.rb | 18 |
1 files changed, 17 insertions, 1 deletions
diff --git a/spec/unit/file_serving/metadata.rb b/spec/unit/file_serving/metadata.rb index 9743370c1..60fcbc3d3 100755 --- a/spec/unit/file_serving/metadata.rb +++ b/spec/unit/file_serving/metadata.rb @@ -99,6 +99,14 @@ describe Puppet::FileServing::Metadata, " when collecting attributes" do @metadata.checksum.should == "{md5}" + @checksum end + it "should give a mtime checksum when checksum_type is set" do + time = Time.now + @metadata.checksum_type = "mtime" + @metadata.expects(:mtime_file).returns(@time) + @metadata.collect_attributes + @metadata.checksum.should == "{mtime}" + @time.to_s + end + it "should produce tab-separated mode, type, owner, group, and checksum for xmlrpc" do @metadata.attributes_with_tabs.should == "#{0755.to_s}\tfile\t10\t20\t{md5}#{@checksum}" end @@ -109,14 +117,22 @@ describe Puppet::FileServing::Metadata, " when collecting attributes" do @stat.stubs(:ftype).returns("directory") @time = Time.now @metadata.expects(:ctime_file).returns(@time) - @metadata.collect_attributes end it "should only use checksums of type 'ctime' for directories" do + @metadata.collect_attributes + @metadata.checksum.should == "{ctime}" + @time.to_s + end + + it "should only use checksums of type 'ctime' for directories even if checksum_type set" do + @metadata.checksum_type = "mtime" + @metadata.expects(:mtime_file).never + @metadata.collect_attributes @metadata.checksum.should == "{ctime}" + @time.to_s end it "should produce tab-separated mode, type, owner, group, and checksum for xmlrpc" do + @metadata.collect_attributes @metadata.attributes_with_tabs.should == "#{0755.to_s}\tdirectory\t10\t20\t{ctime}#{@time.to_s}" end end |