/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/tree_implementations/test_tree.py

  • Committer: Robert Collins
  • Date: 2008-09-27 22:58:34 UTC
  • mfrom: (3748 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3749.
  • Revision ID: robertc@robertcollins.net-20080927225834-030vklra0bu3f0bc
Resolve NEWS.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
from bzrlib import (
18
18
    errors,
19
19
    conflicts,
 
20
    osutils,
20
21
    revisiontree,
21
22
    tests,
22
23
    workingtree_4,
238
239
        tree.lock_read()
239
240
        self.addCleanup(tree.unlock)
240
241
        self.assertEqual(expected, list(tree.extras()))
 
242
 
 
243
class TestHasId(TestCaseWithTree):
 
244
 
 
245
    def test_has_id(self):
 
246
        work_tree = self.make_branch_and_tree('tree')
 
247
        self.build_tree(['tree/file'])
 
248
        work_tree.add('file', 'file-id')
 
249
        tree = self._convert_tree(work_tree)
 
250
        tree.lock_read()
 
251
        self.addCleanup(tree.unlock)
 
252
        self.assertTrue(tree.has_id('file-id'))
 
253
        self.assertFalse(tree.has_id('dir-id'))
 
254
 
 
255
    def test___contains__(self):
 
256
        work_tree = self.make_branch_and_tree('tree')
 
257
        self.build_tree(['tree/file'])
 
258
        work_tree.add('file', 'file-id')
 
259
        tree = self._convert_tree(work_tree)
 
260
        tree.lock_read()
 
261
        self.addCleanup(tree.unlock)
 
262
        self.assertTrue('file-id' in tree)
 
263
        self.assertFalse('dir-id' in tree)
 
264
 
 
265
 
 
266
class TestGetFileSha1(TestCaseWithTree):
 
267
 
 
268
    def test_get_file_sha1(self):
 
269
        work_tree = self.make_branch_and_tree('tree')
 
270
        self.build_tree_contents([('tree/file', 'file content')])
 
271
        work_tree.add('file', 'file-id')
 
272
        tree = self._convert_tree(work_tree)
 
273
        tree.lock_read()
 
274
        self.addCleanup(tree.unlock)
 
275
        expected = osutils.sha_strings('file content')
 
276
        self.assertEqual(expected, tree.get_file_sha1('file-id'))