Back to index

obnam  1.1
Public Member Functions
obnamlib.metadata_tests.MetadataCodingTests Class Reference

List of all members.

Public Member Functions

def test_round_trip
def test_round_trip_for_None_values

Detailed Description

Definition at line 240 of file metadata_tests.py.


Member Function Documentation

Definition at line 242 of file metadata_tests.py.

00242 
00243     def test_round_trip(self):
00244         metadata = obnamlib.metadata.Metadata(st_mode=1, 
00245                                               st_mtime_sec=2, 
00246                                               st_mtime_nsec=12756,
00247                                               st_nlink=3,
00248                                               st_size=4, 
00249                                               st_uid=5, 
00250                                               st_blocks=6, 
00251                                               st_dev=7,
00252                                               st_gid=8, 
00253                                               st_ino=9,  
00254                                               st_atime_sec=10, 
00255                                               st_atime_nsec=123, 
00256                                               groupname='group',
00257                                               username='user',
00258                                               target='target',
00259                                               md5='checksum')
00260         encoded = obnamlib.encode_metadata(metadata)
00261         decoded = obnamlib.decode_metadata(encoded)
00262         for name in dir(metadata):
00263             if name in obnamlib.metadata.metadata_fields:
00264                 self.assertEqual(getattr(metadata, name), 
00265                                  getattr(decoded, name),
00266                                  'attribute %s must be equal (%s vs %s)' % 
00267                                     (name, getattr(metadata, name),
00268                                      getattr(decoded, name)))

Definition at line 269 of file metadata_tests.py.

00269 
00270     def test_round_trip_for_None_values(self):
00271         metadata = obnamlib.metadata.Metadata()
00272         encoded = obnamlib.encode_metadata(metadata)
00273         decoded = obnamlib.decode_metadata(encoded)
00274         for name in dir(metadata):
00275             if name in obnamlib.metadata.metadata_fields:
00276                 self.assertEqual(getattr(decoded, name), None,
00277                                  'attribute %s must be None' % name)
00278 

The documentation for this class was generated from the following file: