summaryrefslogtreecommitdiff
path: root/tests
diff options
context:
space:
mode:
authorMax Bowsher <maxb@f2s.com>2009-11-04 01:04:34 +0000
committerMax Bowsher <maxb@f2s.com>2009-11-04 01:04:34 +0000
commit31d09dacb12813f5b46aff55c03e2992f5bb3ad8 (patch)
tree7432094e7f2b92feb73cb221e6d0ca96995d3c17 /tests
parent2ebaea5d02c1fb3c836d1409587f27a9798eaeb0 (diff)
downloadbzr-fastimport-31d09dacb12813f5b46aff55c03e2992f5bb3ad8.tar.gz
Make BranchMapper just map one name per call.
Move building a dict to the one callsite which actually wants that.
Diffstat (limited to 'tests')
-rw-r--r--tests/test_branch_mapper.py42
1 files changed, 9 insertions, 33 deletions
diff --git a/tests/test_branch_mapper.py b/tests/test_branch_mapper.py
index 0a50eec..00450c9 100644
--- a/tests/test_branch_mapper.py
+++ b/tests/test_branch_mapper.py
@@ -27,62 +27,38 @@ class TestBranchMapper(tests.TestCase):
def test_git_to_bzr(self):
m = branch_mapper.BranchMapper()
- git_refs = [
- 'refs/heads/master',
- 'refs/heads/foo',
- 'refs/tags/master',
- 'refs/tags/foo',
- 'refs/remotes/origin/master',
- 'refs/remotes/origin/foo',
- ]
- git_to_bzr_map = m.git_to_bzr(git_refs)
- self.assertEqual(git_to_bzr_map, {
+ for git, bzr in {
'refs/heads/master': 'trunk',
'refs/heads/foo': 'foo',
'refs/tags/master': 'trunk.tag',
'refs/tags/foo': 'foo.tag',
'refs/remotes/origin/master': 'trunk.remote',
'refs/remotes/origin/foo': 'foo.remote',
- })
+ }.items():
+ self.assertEqual(m.git_to_bzr(git), bzr)
def test_git_to_bzr_with_slashes(self):
m = branch_mapper.BranchMapper()
- git_refs = [
- 'refs/heads/master/slave',
- 'refs/heads/foo/bar',
- 'refs/tags/master/slave',
- 'refs/tags/foo/bar',
- 'refs/remotes/origin/master/slave',
- 'refs/remotes/origin/foo/bar',
- ]
- git_to_bzr_map = m.git_to_bzr(git_refs)
- self.assertEqual(git_to_bzr_map, {
+ for git, bzr in {
'refs/heads/master/slave': 'master/slave',
'refs/heads/foo/bar': 'foo/bar',
'refs/tags/master/slave': 'master/slave.tag',
'refs/tags/foo/bar': 'foo/bar.tag',
'refs/remotes/origin/master/slave': 'master/slave.remote',
'refs/remotes/origin/foo/bar': 'foo/bar.remote',
- })
+ }.items():
+ self.assertEqual(m.git_to_bzr(git), bzr)
def test_git_to_bzr_for_trunk(self):
# As 'master' in git is mapped to trunk in bzr, we need to handle
# 'trunk' in git in a sensible way.
m = branch_mapper.BranchMapper()
- git_refs = [
- 'refs/heads/trunk',
- 'refs/tags/trunk',
- 'refs/remotes/origin/trunk',
- 'refs/heads/git-trunk',
- 'refs/tags/git-trunk',
- 'refs/remotes/origin/git-trunk',
- ]
- git_to_bzr_map = m.git_to_bzr(git_refs)
- self.assertEqual(git_to_bzr_map, {
+ for git, bzr in {
'refs/heads/trunk': 'git-trunk',
'refs/tags/trunk': 'git-trunk.tag',
'refs/remotes/origin/trunk': 'git-trunk.remote',
'refs/heads/git-trunk': 'git-git-trunk',
'refs/tags/git-trunk': 'git-git-trunk.tag',
'refs/remotes/origin/git-trunk':'git-git-trunk.remote',
- })
+ }.items():
+ self.assertEqual(m.git_to_bzr(git), bzr)