/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_push.py

Add more tests, simplify push code.

Show diffs side-by-side

added added

removed removed

Lines of Context:
17
17
 
18
18
"""Tests for pushing revisions from Bazaar into Git."""
19
19
 
 
20
from bzrlib import (
 
21
    errors,
 
22
    )
20
23
from bzrlib.bzrdir import (
21
24
    format_registry,
22
25
    )
24
27
    InterRepository,
25
28
    )
26
29
from bzrlib.tests import (
27
 
    TestCase,
28
30
    TestCaseWithTransport,
29
31
    )
30
32
 
33
35
    )
34
36
 
35
37
 
36
 
class DpushTests(TestCaseWithTransport):
 
38
class InterToGitRepositoryTests(TestCaseWithTransport):
37
39
 
38
40
    def setUp(self):
39
 
        super(DpushTests, self).setUp()
 
41
        super(InterToGitRepositoryTests, self).setUp()
40
42
        self.git_repo = self.make_repository("git",
41
43
                format=format_registry.make_bzrdir("git"))
42
44
        self.bzr_repo = self.make_repository("bzr")
 
45
        self.bzr_repo.lock_read()
 
46
        self.addCleanup(self.bzr_repo.unlock)
43
47
        self.interrepo = InterRepository.get(self.bzr_repo, self.git_repo)
44
48
 
45
49
    def test_instance(self):
46
50
        self.assertIsInstance(self.interrepo, InterToGitRepository)
47
51
 
 
52
    def test_pointless_fetch_refs(self):
 
53
        old_refs, new_refs = self.interrepo.fetch_refs(lambda x: x)
 
54
        self.assertEquals(old_refs, new_refs)
 
55
 
 
56
    def test_pointless_dfetch_refs(self):
 
57
        revidmap, old_refs, new_refs = self.interrepo.dfetch_refs(lambda x: x)
 
58
        self.assertEquals(old_refs, new_refs)
 
59
        self.assertEquals(revidmap, {})
 
60
 
 
61
    def test_pointless_missing_revisions(self):
 
62
        self.assertEquals([], list(self.interrepo.missing_revisions([])))
 
63
 
 
64
    def test_missing_revisions_unknown_stop_rev(self):
 
65
        self.assertRaises(errors.NoSuchRevision,
 
66
                self.interrepo.missing_revisions, ["unknown"])