Back to index

obnam  1.1
Public Member Functions | Public Attributes
obnamlib.metadata_tests.ReadMetadataTests Class Reference

List of all members.

Public Member Functions

def setUp
def test_returns_stat_fields_correctly
def test_returns_symlink_fields_correctly
def test_reads_username_as_None_if_lookup_fails

Public Attributes

 fakefs

Detailed Description

Definition at line 128 of file metadata_tests.py.


Member Function Documentation

Definition at line 130 of file metadata_tests.py.

00130 
00131     def setUp(self):
00132         self.fakefs = FakeFS()

Definition at line 157 of file metadata_tests.py.

00157 
00158     def test_reads_username_as_None_if_lookup_fails(self):
00159         metadata = obnamlib.read_metadata(self.fakefs, 'foo',
00160                                           getpwuid=self.fakefs.fail_getpwuid,
00161                                           getgrgid=self.fakefs.fail_getgrgid)
00162         self.assertEqual(metadata.username, None)
00163 

Definition at line 133 of file metadata_tests.py.

00133 
00134     def test_returns_stat_fields_correctly(self):
00135         metadata = obnamlib.read_metadata(self.fakefs, 'foo', 
00136                                           getpwuid=self.fakefs.getpwuid,
00137                                           getgrgid=self.fakefs.getgrgid)
00138         fields = ['st_atime_sec','st_atime_nsec', 'st_blocks', 'st_dev', 
00139                   'st_gid', 'st_ino', 'st_mode', 'st_mtime_sec', 
00140                   'st_mtime_nsec', 'st_nlink', 'st_size', 'st_uid',
00141                   'groupname', 'username']
00142         for field in fields:
00143             self.assertEqual(getattr(metadata, field),
00144                              getattr(self.fakefs, field),
00145                              field)

Definition at line 146 of file metadata_tests.py.

00146 
00147     def test_returns_symlink_fields_correctly(self):
00148         self.fakefs.st_mode |= stat.S_IFLNK;
00149         metadata = obnamlib.read_metadata(self.fakefs, 'foo', 
00150                                           getpwuid=self.fakefs.getpwuid,
00151                                           getgrgid=self.fakefs.getgrgid)
00152         fields = ['st_mode', 'target']
00153         for field in fields:
00154             self.assertEqual(getattr(metadata, field),
00155                              getattr(self.fakefs, field),
00156                              field)


Member Data Documentation

Definition at line 131 of file metadata_tests.py.


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