summaryrefslogtreecommitdiff
path: root/tests/component/deb
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2014-02-23 16:59:44 +0100
committerGuido Günther <agx@sigxcpu.org>2014-02-23 17:55:44 +0100
commitd533e0f6f418a1cc002786ab7d96481ecc3bd9b4 (patch)
tree40f98dbbdd3abee1128f2ce8318e41abf2a6c8e5 /tests/component/deb
parent7e26f91a753a5a782b4da6cbf4321b1bd6bd9a95 (diff)
downloadgit-buildpackage-d533e0f6f418a1cc002786ab7d96481ecc3bd9b4.tar.gz
git-buildpackage-d533e0f6f418a1cc002786ab7d96481ecc3bd9b4.tar.bz2
git-buildpackage-d533e0f6f418a1cc002786ab7d96481ecc3bd9b4.zip
import_dsc: Create missing debian branch with --create-missing-branches
Closes: #739888
Diffstat (limited to 'tests/component/deb')
m---------tests/component/deb/data0
-rw-r--r--tests/component/deb/test_import_dsc.py34
2 files changed, 32 insertions, 2 deletions
diff --git a/tests/component/deb/data b/tests/component/deb/data
-Subproject fce347ecd0739fe29776a761775a92456a362af
+Subproject a06e148c09b6f9c9057ecdcabcbeed7d71ba0a1
diff --git a/tests/component/deb/test_import_dsc.py b/tests/component/deb/test_import_dsc.py
index bccdb077..da166152 100644
--- a/tests/component/deb/test_import_dsc.py
+++ b/tests/component/deb/test_import_dsc.py
@@ -1,6 +1,6 @@
# vim: set fileencoding=utf-8 :
#
-# (C) 2013 Guido Günther <agx@sigxcpu.org>
+# (C) 2013,2014 Guido Günther <agx@sigxcpu.org>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@@ -22,10 +22,12 @@ from tests.component import (ComponentTestBase,
ComponentTestGitRepository)
from tests.component.deb import DEB_TEST_DATA_DIR
+from nose.tools import ok_
+
from gbp.scripts.import_dsc import main as import_dsc
class TestImportDsc(ComponentTestBase):
- """Test importing of src.rpm files"""
+ """Test importing of debian source packages"""
def test_debian_import(self):
"""Test that importing of debian native packages works"""
@@ -50,3 +52,31 @@ class TestImportDsc(ComponentTestBase):
assert import_dsc(['arg0', dsc]) == 0
self._check_repo_state(repo, 'master', ['master'])
assert len(repo.get_commits()) == 3
+
+ def test_create_branches(self):
+ """Test if creating missing branches works"""
+ def _dsc(version):
+ return os.path.join(DEB_TEST_DATA_DIR,
+ 'dsc-3.0',
+ 'hello-debhelper_%s.dsc' % version)
+
+ dsc = _dsc('2.6-2')
+ assert import_dsc(['arg0',
+ '--pristine-tar',
+ '--debian-branch=master',
+ '--upstream-branch=upstream',
+ dsc]) == 0
+ repo = ComponentTestGitRepository('hello-debhelper')
+ os.chdir('hello-debhelper')
+ assert len(repo.get_commits()) == 2
+ self._check_repo_state(repo, 'master', ['master', 'pristine-tar', 'upstream'])
+ dsc = _dsc('2.8-1')
+ assert import_dsc(['arg0',
+ '--pristine-tar',
+ '--debian-branch=foo',
+ '--upstream-branch=bar',
+ '--create-missing-branches',
+ dsc]) == 0
+ self._check_repo_state(repo, 'master', ['bar', 'foo', 'master', 'pristine-tar', 'upstream'])
+ commits, expected = len(repo.get_commits()), 2
+ ok_(commits == expected, "Found %d commit instead of %d" % (commits, expected))