summaryrefslogtreecommitdiff
path: root/test/tc_restore_file.rb
diff options
context:
space:
mode:
authorPatrick J Cherry <patrick@bytemark.co.uk>2015-12-01 22:41:06 +0000
committerPatrick J Cherry <patrick@bytemark.co.uk>2015-12-01 22:41:06 +0000
commit668b9871e64cb82ac30c8defb29d56d774f3c140 (patch)
tree9b4bba7cbcbd2660485cf803402c4d4889e62b10 /test/tc_restore_file.rb
parent182a03798d49a3c0450b0f137977037cf9376e99 (diff)
Completely re-vamped restore command. Fixes #12403
The byteback-restore command now uses the rsync xattrs to display information about the files due to be restored. It can handle filenames with spaces (!) and other characters.
Diffstat (limited to 'test/tc_restore_file.rb')
-rw-r--r--test/tc_restore_file.rb22
1 files changed, 22 insertions, 0 deletions
diff --git a/test/tc_restore_file.rb b/test/tc_restore_file.rb
new file mode 100644
index 0000000..b0497b3
--- /dev/null
+++ b/test/tc_restore_file.rb
@@ -0,0 +1,22 @@
+$: << File.dirname(__FILE__)+"/../lib"
+
+require 'test/unit'
+require 'byteback/restore_file'
+require 'tempfile'
+
+class BytebackFileTest < Test::Unit::TestCase
+
+ def test_general
+ f = Tempfile.new($0)
+ system("setfattr --name user.rsync.%stat -v \"41755 12,34 56:78\" #{f.path}")
+ b = Byteback::RestoreFile.new(f.path)
+ assert_equal(041755, b.mode)
+ assert_equal(12, b.maj)
+ assert_equal(34, b.min)
+ assert_equal(56, b.uid)
+ assert_equal(78, b.gid)
+ assert_equal("drwxr-xr-t", b.modestring)
+ assert_kind_of(Time, f.mtime)
+ end
+
+end