~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_foreign.py

  • Committer: Canonical.com Patch Queue Manager
  • Date: 2009-01-27 20:24:43 UTC
  • mfrom: (3960.2.1 1.12-progress-warnings)
  • Revision ID: pqm@pqm.ubuntu.com-20090127202443-ty2bu1hh91dumasz
(jam) Avoid getting a UserWarning by not creating an unused progress
        bar.

Show diffs side-by-side

added added

removed removed

Lines of Context:
28
28
    def __eq__(self, other):
29
29
        return type(self) == type(other)
30
30
 
 
31
    def show_foreign_revid(self, foreign_revid):
 
32
        return { "dummy ding": "%s/%s\\%s" % foreign_revid }
 
33
 
31
34
    def revision_id_bzr_to_foreign(self, bzr_revid):
32
35
        return tuple(bzr_revid[len("dummy-v1:"):].split("-")), self
33
36
 
53
56
 
54
57
    def __init__(self):
55
58
        self.mapping_registry = DummyForeignVcsMappingRegistry()
56
 
        self.mapping_registry.register("v1", DummyForeignVcsMapping(self), 
 
59
        self.mapping_registry.register("v1", DummyForeignVcsMapping(), 
57
60
                                       "Version 1")
58
61
 
59
 
    def show_foreign_revid(self, foreign_revid):
60
 
        return { "dummy ding": "%s/%s\\%s" % foreign_revid }
61
 
 
62
 
 
63
62
 
64
63
class ForeignVcsRegistryTests(TestCase):
65
64
 
75
74
 
76
75
    def test_parse_revision_id(self):
77
76
        reg = foreign.ForeignVcsRegistry()
78
 
        vcs = DummyForeignVcs()
79
 
        reg.register("dummy", vcs, "Dummy VCS")
80
 
        self.assertEquals((("some", "foreign", "revid"), DummyForeignVcsMapping(vcs)),
 
77
        reg.register("dummy", DummyForeignVcs(), "Dummy VCS")
 
78
        self.assertEquals((("some", "foreign", "revid"), DummyForeignVcsMapping()),
81
79
                          reg.parse_revision_id("dummy-v1:some-foreign-revid"))
82
80
 
83
81
 
85
83
    """Tests for the ForeignRevision class."""
86
84
 
87
85
    def test_create(self):
88
 
        mapp = DummyForeignVcsMapping(DummyForeignVcs())
 
86
        mapp = DummyForeignVcsMapping()
89
87
        rev = foreign.ForeignRevision(("a", "foreign", "revid"), 
90
88
                                      mapp, "roundtripped-revid")
91
89
        self.assertEquals("", rev.inventory_sha1)
98
96
 
99
97
    def setUp(self):
100
98
        super(ShowForeignPropertiesTests, self).setUp()
101
 
        self.vcs = DummyForeignVcs()
102
99
        foreign.foreign_vcs_registry.register("dummy", 
103
 
            self.vcs, "Dummy VCS")
 
100
            DummyForeignVcs(), "Dummy VCS")
104
101
 
105
102
    def tearDown(self):
106
103
        super(ShowForeignPropertiesTests, self).tearDown()
117
114
 
118
115
    def test_show_direct(self):
119
116
        rev = foreign.ForeignRevision(("some", "foreign", "revid"), 
120
 
                                      DummyForeignVcsMapping(self.vcs), 
 
117
                                      DummyForeignVcsMapping(), 
121
118
                                      "roundtrip-revid")
122
119
        self.assertEquals({ "dummy ding": "some/foreign\\revid" },
123
120
                          foreign.show_foreign_properties(rev))