diff options
author | Lars Wirzenius <liw@liw.fi> | 2011-08-08 14:50:00 +0100 |
---|---|---|
committer | Lars Wirzenius <liw@liw.fi> | 2011-08-08 14:50:00 +0100 |
commit | 68f67f9b71e1bbc9647d350cb6b62d72ebfbeab9 (patch) | |
tree | db154257120b54ab0b83c46fc2cb627dbed8743f /summainlib_tests.py | |
parent | 74d9866867cc38dd0857b071c0ed09d4fb7512ef (diff) | |
download | summain-68f67f9b71e1bbc9647d350cb6b62d72ebfbeab9.tar.gz |
Move output formatting out from FilesystemObject class.
Diffstat (limited to 'summainlib_tests.py')
-rw-r--r-- | summainlib_tests.py | 61 |
1 files changed, 30 insertions, 31 deletions
diff --git a/summainlib_tests.py b/summainlib_tests.py index 6015541..5c10f72 100644 --- a/summainlib_tests.py +++ b/summainlib_tests.py @@ -85,13 +85,12 @@ class FilesystemObjectTests(unittest.TestCase): self.nn = summainlib.NumberNormalizer() self.pn = summainlib.SamePath() self.exclude = [] - self.checksums = ['SHA1'] def new(self, name, mode=None): if mode is not None: self.st.st_mode = mode return summainlib.FilesystemObject(name, self.nn, self.pn, - self.exclude, self.checksums, + self.exclude, stat_result=self.st, sha1=FakeChecksummer(), sha224=FakeChecksummer(), @@ -169,34 +168,34 @@ class FilesystemObjectTests(unittest.TestCase): def test_formats_target_correctly_for_regular_file(self): self.assertEqual(self.new('foo')['Target'], '') - def test_does_not_output_size_for_directory(self): - fso = self.new('foo', mode=stat.S_IFDIR | 0777) - output = fso.format() - self.assert_('Size:' not in output) - - def test_relative_path_returns_path_if_not_starting_with_root(self): - fso = self.new('/foo/bar') - self.assertEqual(fso.relative_path('/yo'), '/foo/bar') - - def test_relative_path_returns_partial_path_if_starting_with_root(self): - fso = self.new('/foo/bar') - self.assertEqual(fso.relative_path('/foo'), 'bar') - - def test_relative_path_returns_dot_if_same_as_root_and_dir(self): - fso = self.new('/foo/bar', mode=stat.S_IFDIR) - self.assertEqual(fso.relative_path('/foo/bar'), '.') - - def test_relative_path_returns_path_if_same_as_root_and_not_dir(self): - fso = self.new('/foo/bar', mode=stat.S_IFREG) - self.assertEqual(fso.relative_path('/foo/bar'), '/foo/bar') - - def test_relative_path_returns_path_if_root_is_slashless_prefix(self): - fso = self.new('/foobar', mode=stat.S_IFREG) - self.assertEqual(fso.relative_path('/foo'), '/foobar') - - def test_relative_path_returns_partial_path_if_root_ends_in_slash(self): - fso = self.new('/foo/bar', mode=stat.S_IFREG) - self.assertEqual(fso.relative_path('/foo/'), 'bar') +# def test_does_not_output_size_for_directory(self): +# fso = self.new('foo', mode=stat.S_IFDIR | 0777) +# output = fso.format() +# self.assert_('Size:' not in output) +# +# def test_relative_path_returns_path_if_not_starting_with_root(self): +# fso = self.new('/foo/bar') +# self.assertEqual(fso.relative_path('/yo'), '/foo/bar') +# +# def test_relative_path_returns_partial_path_if_starting_with_root(self): +# fso = self.new('/foo/bar') +# self.assertEqual(fso.relative_path('/foo'), 'bar') +# +# def test_relative_path_returns_dot_if_same_as_root_and_dir(self): +# fso = self.new('/foo/bar', mode=stat.S_IFDIR) +# self.assertEqual(fso.relative_path('/foo/bar'), '.') +# +# def test_relative_path_returns_path_if_same_as_root_and_not_dir(self): +# fso = self.new('/foo/bar', mode=stat.S_IFREG) +# self.assertEqual(fso.relative_path('/foo/bar'), '/foo/bar') +# +# def test_relative_path_returns_path_if_root_is_slashless_prefix(self): +# fso = self.new('/foobar', mode=stat.S_IFREG) +# self.assertEqual(fso.relative_path('/foo'), '/foobar') +# +# def test_relative_path_returns_partial_path_if_root_ends_in_slash(self): +# fso = self.new('/foo/bar', mode=stat.S_IFREG) +# self.assertEqual(fso.relative_path('/foo/'), 'bar') def test_excludes_unwanted_fields_from_output(self): self.exclude = ['mtime'] @@ -224,7 +223,7 @@ class FilesystemObjectNormalizedNumbersTests(unittest.TestCase): st_uid=0, st_gid=0) self.ino += 1 return summainlib.FilesystemObject(name, self.nn, self.pn, - self.exclude, self.checksums, + self.exclude, stat_result=st, sha1=FakeChecksummer(), sha224=FakeChecksummer(), |