diff options
author | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-07-18 21:31:14 +0000 |
---|---|---|
committer | bescoto <bescoto@2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109> | 2003-07-18 21:31:14 +0000 |
commit | 3f6645f4282082c2e140b52780a9a500c8212f82 (patch) | |
tree | d19611f85b77d4775ed860c0db9850d7d78f0743 /rdiff-backup/testing/resourceforktest.py | |
parent | e9a90e94befd8aaf5185be59d13d946d8b121936 (diff) | |
download | rdiff-backup-3f6645f4282082c2e140b52780a9a500c8212f82.tar.gz |
Added Daniel Hazelbaker's resource fork code, plus detection to fs_abilities and a new unittest file.
git-svn-id: http://svn.savannah.nongnu.org/svn/rdiff-backup/trunk@345 2b77aa54-bcbc-44c9-a7ec-4f6cf2b41109
Diffstat (limited to 'rdiff-backup/testing/resourceforktest.py')
-rw-r--r-- | rdiff-backup/testing/resourceforktest.py | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/rdiff-backup/testing/resourceforktest.py b/rdiff-backup/testing/resourceforktest.py new file mode 100644 index 0000000..09cc1d0 --- /dev/null +++ b/rdiff-backup/testing/resourceforktest.py @@ -0,0 +1,53 @@ +import unittest +from commontest import * +from rdiff_backup import rpath +from rdiff_backup import metadata + +"""***NOTE*** + +None of these tests should work unless your system supports resource +forks. So basically these tests should only be run on Mac OS X. + +""" + +Globals.read_resource_forks = Globals.write_resource_forks = 1 + +class ResourceForkTest(unittest.TestCase): + """Test dealing with Mac OS X style resource forks""" + tempdir = rpath.RPath(Globals.local_connection, + 'testfiles/resource_fork_test') + def make_temp(self): + """Make temp directory testfiles/resource_fork_test""" + if self.tempdir.lstat(): self.tempdir.delete() + self.tempdir.mkdir() + + def testBasic(self): + """Test basic reading and writing of resource forks""" + self.make_temp() + rp = self.tempdir.append('test') + rp.touch() + assert rp.get_resource_fork() == '', rp.get_resource_fork() + + s = 'new resource fork data' + rp.write_resource_fork(s) + assert rp.get_resource_fork() == s, rp.get_resource_fork() + + rp2 = self.tempdir.append('test') + assert rp2.isreg() + assert rp2.get_resource_fork() == s, rp2.get_resource_fork() + + def testRecord(self): + """Test reading, writing, and comparing of records with rforks""" + self.make_temp() + rp = self.tempdir.append('test') + rp.touch() + rp.set_resource_fork('hello') + + record = metadata.RORP2Record(rp) + #print record + rorp_out = metadata.Record2RORP(record) + assert rorp_out == rp, (rorp_out, rp) + assert rorp_out.get_resource_fork() == 'hello' + + +if __name__ == "__main__": unittest.main() |