~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2011-08-17 21:39:37 UTC
  • mfrom: (6072.2.5 match-tree-layout)
  • Revision ID: pqm@pqm.ubuntu.com-20110817213937-lzul6u2qz1svvgxm
(jelmer) Add a HasLayout matcher. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
24
24
    tests,
25
25
    )
26
26
 
 
27
from bzrlib.tests.matchers import HasLayout
27
28
from bzrlib.tests.per_workingtree import TestCaseWithWorkingTree
28
29
from bzrlib.tests import (
29
30
    features,
32
33
 
33
34
class TestMove(TestCaseWithWorkingTree):
34
35
 
35
 
    def get_tree_layout(self, tree):
36
 
        """Get the (path, file_id) pairs for the current tree."""
37
 
        tree.lock_read()
38
 
        try:
39
 
            return [(path, ie.file_id) for path, ie
40
 
                    in tree.iter_entries_by_dir()]
41
 
        finally:
42
 
            tree.unlock()
43
 
 
44
36
    def assertTreeLayout(self, expected, tree):
45
37
        """Check that the tree has the correct layout."""
46
 
        actual = self.get_tree_layout(tree)
47
 
        self.assertEqual(expected, actual)
 
38
        self.assertThat(tree, HasLayout(expected))
48
39
 
49
40
    def test_move_via_rm_and_add(self):
50
41
        """Move by remove and add-with-id"""