/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 tests/test_object_store.py

Add tests for find_missing_bzr_revids.

Show diffs side-by-side

added added

removed removed

Lines of Context:
20
20
    Blob,
21
21
    )
22
22
 
 
23
from bzrlib.graph import (
 
24
    DictParentsProvider,
 
25
    )
23
26
from bzrlib.tests import (
24
27
    TestCase,
25
28
    )
26
29
 
27
30
from bzrlib.plugins.git.object_store import (
28
31
    _check_expected_sha,
 
32
    _find_missing_bzr_revids,
29
33
    )
30
34
 
31
35
 
48
52
        _check_expected_sha(self.obj.sha().digest(), self.obj)
49
53
        self.assertRaises(AssertionError, _check_expected_sha, 
50
54
            "x" * 20, self.obj)
 
55
 
 
56
 
 
57
class FindMissingBzrRevidsTests(TestCase):
 
58
 
 
59
    def _find_missing(self, ancestry, want, have):
 
60
        return _find_missing_bzr_revids(
 
61
            DictParentsProvider(ancestry).get_parent_map,
 
62
            set(want), set(have))
 
63
 
 
64
    def test_simple(self):
 
65
        self.assertEquals(set(), self._find_missing({}, [], []))
 
66
 
 
67
    def test_up_to_date(self):
 
68
        self.assertEquals(set(),
 
69
                self._find_missing({"a": ["b"]}, ["a"], ["a"]))
 
70
 
 
71
    def test_one_missing(self):
 
72
        self.assertEquals(set(["a"]),
 
73
                self._find_missing({"a": ["b"]}, ["a"], ["b"]))