~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/per_workingtree/test_add.py

  • Committer: Jelmer Vernooij
  • Date: 2011-08-16 13:15:28 UTC
  • mto: This revision was merged to the branch mainline in revision 6080.
  • Revision ID: jelmer@samba.org-20110816131528-14egox15vxqfwky7
Use HasLayout matcher.

Show diffs side-by-side

added added

removed removed

Lines of Context:
21
21
    inventory,
22
22
    tests,
23
23
    )
 
24
from bzrlib.tests.matchers import HasLayout
24
25
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
25
26
 
26
27
 
27
28
class TestAdd(TestCaseWithWorkingTree):
28
29
 
29
 
    def get_tree_layout(self, tree):
30
 
        """Get the (path, file_id) pairs for the current tree."""
31
 
        tree.lock_read()
32
 
        try:
33
 
            return [(path, ie.file_id) for path, ie
34
 
                    in tree.iter_entries_by_dir()]
35
 
        finally:
36
 
            tree.unlock()
37
 
 
38
30
    def assertTreeLayout(self, expected, tree):
39
31
        """Check that the tree has the correct layout."""
40
 
        actual = self.get_tree_layout(tree)
41
 
        self.assertEqual(expected, actual)
 
32
        self.assertThat(tree, HasLayout(expected))
42
33
 
43
34
    def test_add_one(self):
44
35
        tree = self.make_branch_and_tree('.')