~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_foreign.py

  • Committer: John Arbash Meinel
  • Date: 2009-02-23 15:29:35 UTC
  • mfrom: (3943.7.7 bzr.code_style_cleanup)
  • mto: This revision was merged to the branch mainline in revision 4033.
  • Revision ID: john@arbash-meinel.com-20090223152935-oel9m92mwcc6nb4h
Merge the removal of all trailing whitespace, and resolve conflicts.

Show diffs side-by-side

added added

removed removed

Lines of Context:
47
47
 
48
48
class DummyForeignVcs(foreign.ForeignVcs):
49
49
    """A dummy Foreign VCS, for use with testing.
50
 
    
 
50
 
51
51
    It has revision ids that are a tuple with three strings.
52
52
    """
53
53
 
54
54
    def __init__(self):
55
55
        self.mapping_registry = DummyForeignVcsMappingRegistry()
56
 
        self.mapping_registry.register("v1", DummyForeignVcsMapping(self), 
 
56
        self.mapping_registry.register("v1", DummyForeignVcsMapping(self),
57
57
                                       "Version 1")
58
58
 
59
59
    def show_foreign_revid(self, foreign_revid):
63
63
 
64
64
class ForeignVcsRegistryTests(TestCase):
65
65
 
66
 
    def test_parse_revision_id_no_dash(self):       
 
66
    def test_parse_revision_id_no_dash(self):
67
67
        reg = foreign.ForeignVcsRegistry()
68
 
        self.assertRaises(errors.InvalidRevisionId, 
 
68
        self.assertRaises(errors.InvalidRevisionId,
69
69
                          reg.parse_revision_id, "invalid")
70
 
        
71
 
    def test_parse_revision_id_unknown_mapping(self):       
 
70
 
 
71
    def test_parse_revision_id_unknown_mapping(self):
72
72
        reg = foreign.ForeignVcsRegistry()
73
 
        self.assertRaises(errors.InvalidRevisionId, 
 
73
        self.assertRaises(errors.InvalidRevisionId,
74
74
                          reg.parse_revision_id, "unknown-foreignrevid")
75
75
 
76
76
    def test_parse_revision_id(self):
86
86
 
87
87
    def test_create(self):
88
88
        mapp = DummyForeignVcsMapping(DummyForeignVcs())
89
 
        rev = foreign.ForeignRevision(("a", "foreign", "revid"), 
 
89
        rev = foreign.ForeignRevision(("a", "foreign", "revid"),
90
90
                                      mapp, "roundtripped-revid")
91
91
        self.assertEquals("", rev.inventory_sha1)
92
92
        self.assertEquals(("a", "foreign", "revid"), rev.foreign_revid)
99
99
    def setUp(self):
100
100
        super(ShowForeignPropertiesTests, self).setUp()
101
101
        self.vcs = DummyForeignVcs()
102
 
        foreign.foreign_vcs_registry.register("dummy", 
 
102
        foreign.foreign_vcs_registry.register("dummy",
103
103
            self.vcs, "Dummy VCS")
104
104
 
105
105
    def tearDown(self):
116
116
                          foreign.show_foreign_properties(rev))
117
117
 
118
118
    def test_show_direct(self):
119
 
        rev = foreign.ForeignRevision(("some", "foreign", "revid"), 
120
 
                                      DummyForeignVcsMapping(self.vcs), 
 
119
        rev = foreign.ForeignRevision(("some", "foreign", "revid"),
 
120
                                      DummyForeignVcsMapping(self.vcs),
121
121
                                      "roundtrip-revid")
122
122
        self.assertEquals({ "dummy ding": "some/foreign\\revid" },
123
123
                          foreign.show_foreign_properties(rev))