diff options
author | Lars Wirzenius <liw@liw.fi> | 2010-01-01 02:56:16 +0200 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2010-01-01 02:56:16 +0200 |
commit | 96f9c72e35c9a496d1ad439518e7072591b3ec92 (patch) | |
tree | 2175d392d8f62d6326f067c05a38d907972ebbfa | |
parent | 3a5fc4f3da2165faf615b96b16b40bfc2a330281 (diff) | |
download | summain-96f9c72e35c9a496d1ad439518e7072591b3ec92.tar.gz |
Implement st_uid formatting. With unit test.
-rw-r--r-- | summainlib.py | 1 | ||||
-rw-r--r-- | summainlib_tests.py | 6 |
2 files changed, 6 insertions, 1 deletions
diff --git a/summainlib.py b/summainlib.py index 70b27cf..5ce9f10 100644 --- a/summainlib.py +++ b/summainlib.py @@ -40,6 +40,7 @@ class FilesystemObject(object): self['Dev'] = '%d' % stat_result.st_dev self['Nlink'] = '%d' % stat_result.st_nlink self['Size'] = '%d' % stat_result.st_size + self['Uid'] = '%d' % stat_result.st_uid def format_time(self, timestamp): return time.strftime('%Y-%m-%d %H:%M:%S +0000', diff --git a/summainlib_tests.py b/summainlib_tests.py index 2eb3119..7f5a9fd 100644 --- a/summainlib_tests.py +++ b/summainlib_tests.py @@ -35,7 +35,8 @@ class FilesystemObjectTests(unittest.TestCase): st_ino=12765, st_dev=42, st_nlink=2, - st_size=1) + st_size=1, + st_uid=0) def new(self, name): return summainlib.FilesystemObject(name, stat_result=self.st) @@ -65,3 +66,6 @@ class FilesystemObjectTests(unittest.TestCase): def test_formats_size_correctly(self): self.assertEqual(self.new('foo')['Size'], '1') + def test_formats_uid_correctly(self): + self.assertEqual(self.new('foo')['Uid'], '0') + |