diff options
author | Lars Wirzenius <liw@liw.fi> | 2010-07-10 17:28:01 +1200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2010-07-10 17:28:01 +1200 |
commit | fe51b60533bd8b730597aa5b4c6fbd69b6e0cb21 (patch) | |
tree | a93097abd20ad31a7107d1a48002a5552ce99915 | |
parent | 663f7d57367845021dbde70d5cbf96eb83ec5bd9 (diff) | |
download | obnam-fe51b60533bd8b730597aa5b4c6fbd69b6e0cb21.tar.gz |
Add tests for metadata coding.
-rw-r--r-- | obnamlib/store_tests.py | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/obnamlib/store_tests.py b/obnamlib/store_tests.py index 38b8daef..ae6210fa 100644 --- a/obnamlib/store_tests.py +++ b/obnamlib/store_tests.py @@ -24,6 +24,30 @@ import unittest import obnamlib +class MetadataCodingTests(unittest.TestCase): + + def test_round_trip(self): + metadata = obnamlib.metadata.Metadata(st_mode=1, + st_mtime=2, + st_nlink=3, + st_size=4, + st_uid=5, + st_blocks=6, + st_dev=7, + st_gid=8, + st_ino=9, + st_atime=10, + groupname='group', + username='user', + target='target') + encoded = obnamlib.store.encode_metadata(metadata) + decoded = obnamlib.store.decode_metadata(encoded) + for name in dir(metadata): + if name in obnamlib.metadata.metadata_fields: + self.assertEqual(getattr(metadata, name), + getattr(decoded, name)) + + class ChecksumTreeTests(unittest.TestCase): def setUp(self): |