summaryrefslogtreecommitdiff
path: root/rdiff-backup/testing
diff options
context:
space:
mode:
authorbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-12-08 19:49:29 +0000
committerbescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109>2002-12-08 19:49:29 +0000
commitc1a39e88df7ec66297635f519cb1f3fbd1b584f0 (patch)
treeda3784f19de5417a75880947eb3208344d5a8690 /rdiff-backup/testing
parent390e37074558f83a2df042019910a73a03a0c1fa (diff)
downloadrdiff-backup-c1a39e88df7ec66297635f519cb1f3fbd1b584f0.tar.gz
Initial checkin of metadata code
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@243 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing')
-rw-r--r--rdiff-backup/testing/metadatatest.py31
1 files changed, 31 insertions, 0 deletions
diff --git a/rdiff-backup/testing/metadatatest.py b/rdiff-backup/testing/metadatatest.py
new file mode 100644
index 0000000..bad6d27
--- /dev/null
+++ b/rdiff-backup/testing/metadatatest.py
@@ -0,0 +1,31 @@
+import unittest, os
+from rdiff_backup.metadata import *
+from rdiff_backup import rpath, Globals
+
+class MetadataTest(unittest.TestCase):
+ def testQuote(self):
+ """Test quoting and unquoting"""
+ filenames = ["foo", ".", "hello\nthere", "\\", "\\\\\\",
+ "h\no\t\x87\n", " "]
+ for filename in filenames:
+ quoted = quote_path(filename)
+ assert not "\n" in quoted
+ result = unquote_path(quoted)
+ assert result == filename, (quoted, result, filename)
+
+ def testRORP2Record(self):
+ """Test turning RORPs into records and back again"""
+ vft = rpath.RPath(Globals.local_connection,
+ "testfiles/various_file_types")
+ rpaths = map(lambda x: vft.append(x), vft.listdir())
+ extra_rpaths = map(lambda x: rpath.RPath(Globals.local_connection, x),
+ ['/bin/ls', '/dev/ttyS0', '/dev/hda', 'aoeuaou'])
+
+ for rp in [vft] + rpaths + extra_rpaths:
+ record = RORP2Record(rp)
+ #print record
+ new_rorp = Record2RORP(record)
+ assert new_rorp == rp, (new_rorp, rp, record)
+
+
+if __name__ == "__main__": unittest.main()