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

Default branch nick to mapped git ref name (Max Bowsher)

Show diffs side-by-side

added added

removed removed

Lines of Context:
27
27
 
28
28
    def test_git_to_bzr(self):
29
29
        m = branch_mapper.BranchMapper()
30
 
        git_refs = [
31
 
            'refs/heads/master',
32
 
            'refs/heads/foo',
33
 
            'refs/tags/master',
34
 
            'refs/tags/foo',
35
 
            'refs/remotes/origin/master',
36
 
            'refs/remotes/origin/foo',
37
 
            ]
38
 
        git_to_bzr_map = m.git_to_bzr(git_refs)
39
 
        self.assertEqual(git_to_bzr_map, {
 
30
        for git, bzr in {
40
31
            'refs/heads/master':                'trunk',
41
32
            'refs/heads/foo':                   'foo',
42
33
            'refs/tags/master':                 'trunk.tag',
43
34
            'refs/tags/foo':                    'foo.tag',
44
35
            'refs/remotes/origin/master':       'trunk.remote',
45
36
            'refs/remotes/origin/foo':          'foo.remote',
46
 
            })
 
37
            }.items():
 
38
            self.assertEqual(m.git_to_bzr(git), bzr)
47
39
 
48
40
    def test_git_to_bzr_with_slashes(self):
49
41
        m = branch_mapper.BranchMapper()
50
 
        git_refs = [
51
 
            'refs/heads/master/slave',
52
 
            'refs/heads/foo/bar',
53
 
            'refs/tags/master/slave',
54
 
            'refs/tags/foo/bar',
55
 
            'refs/remotes/origin/master/slave',
56
 
            'refs/remotes/origin/foo/bar',
57
 
            ]
58
 
        git_to_bzr_map = m.git_to_bzr(git_refs)
59
 
        self.assertEqual(git_to_bzr_map, {
 
42
        for git, bzr in {
60
43
            'refs/heads/master/slave':              'master/slave',
61
44
            'refs/heads/foo/bar':                   'foo/bar',
62
45
            'refs/tags/master/slave':               'master/slave.tag',
63
46
            'refs/tags/foo/bar':                    'foo/bar.tag',
64
47
            'refs/remotes/origin/master/slave':     'master/slave.remote',
65
48
            'refs/remotes/origin/foo/bar':          'foo/bar.remote',
66
 
            })
 
49
            }.items():
 
50
            self.assertEqual(m.git_to_bzr(git), bzr)
67
51
 
68
52
    def test_git_to_bzr_for_trunk(self):
69
53
        # As 'master' in git is mapped to trunk in bzr, we need to handle
70
54
        # 'trunk' in git in a sensible way.
71
55
        m = branch_mapper.BranchMapper()
72
 
        git_refs = [
73
 
            'refs/heads/trunk',
74
 
            'refs/tags/trunk',
75
 
            'refs/remotes/origin/trunk',
76
 
            'refs/heads/git-trunk',
77
 
            'refs/tags/git-trunk',
78
 
            'refs/remotes/origin/git-trunk',
79
 
            ]
80
 
        git_to_bzr_map = m.git_to_bzr(git_refs)
81
 
        self.assertEqual(git_to_bzr_map, {
 
56
        for git, bzr in {
82
57
            'refs/heads/trunk':             'git-trunk',
83
58
            'refs/tags/trunk':              'git-trunk.tag',
84
59
            'refs/remotes/origin/trunk':    'git-trunk.remote',
85
60
            'refs/heads/git-trunk':         'git-git-trunk',
86
61
            'refs/tags/git-trunk':          'git-git-trunk.tag',
87
62
            'refs/remotes/origin/git-trunk':'git-git-trunk.remote',
88
 
            })
 
63
            }.items():
 
64
            self.assertEqual(m.git_to_bzr(git), bzr)