/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_osutils.py

  • Committer: John Arbash Meinel
  • Date: 2007-10-22 16:03:11 UTC
  • mto: This revision was merged to the branch mainline in revision 2923.
  • Revision ID: john@arbash-meinel.com-20071022160311-o9ghjovhh6s734n3
Add tests for sha_file_by_name.

Show diffs side-by-side

added added

removed removed

Lines of Context:
277
277
        foo_baz_path = osutils.pathjoin(foo_path, 'baz')
278
278
        self.assertEqual(baz_path, osutils.dereference_path(foo_baz_path))
279
279
 
280
 
 
281
280
    def test_changing_access(self):
282
281
        f = file('file', 'w')
283
282
        f.write('monkey')
299
298
            osutils.make_readonly('dangling')
300
299
            osutils.make_writable('dangling')
301
300
 
302
 
 
303
301
    def test_kind_marker(self):
304
302
        self.assertEqual("", osutils.kind_marker("file"))
305
303
        self.assertEqual("/", osutils.kind_marker(osutils._directory_kind))
1050
1048
        self.assertTrue(isinstance(offset, int))
1051
1049
        eighteen_hours = 18 * 3600
1052
1050
        self.assertTrue(-eighteen_hours < offset < eighteen_hours)
 
1051
 
 
1052
 
 
1053
class TestShaFileByName(TestCaseInTempDir):
 
1054
 
 
1055
    def test_sha_empty(self):
 
1056
        self.build_tree_contents([('foo', '')])
 
1057
        expected_sha = osutils.sha_string('')
 
1058
        self.assertEqual(expected_sha, osutils.sha_file_by_name('foo'))
 
1059
 
 
1060
    def test_sha_mixed_endings(self):
 
1061
        text = 'test\r\nwith\nall\rpossible line endings\r\n'
 
1062
        self.build_tree_contents([('foo', text)])
 
1063
        expected_sha = osutils.sha_string(text)
 
1064
        self.assertEqual(expected_sha, osutils.sha_file_by_name('foo'))