From c1a39e88df7ec66297635f519cb1f3fbd1b584f0 Mon Sep 17 00:00:00 2001 From: bescoto Date: Sun, 8 Dec 2002 19:49:29 +0000 Subject: Initial checkin of metadata code git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@243 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109 --- rdiff-backup/testing/metadatatest.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 rdiff-backup/testing/metadatatest.py (limited to 'rdiff-backup/testing') 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() -- cgit v1.2.1