aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/24_test_gbp_import_orig.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2017-04-04 07:13:15 +0200
committerGuido Günther <agx@sigxcpu.org>2017-04-12 11:19:09 +0200
commite890ce326ee66e0339ae4c83644473173fc4758e (patch)
tree9eeddd3c212c0b1c1af1ee894363ba973bf10e9a /tests/24_test_gbp_import_orig.py
parent7cfe71d6d45399ded9b50209a2c0dcbf132afd3d (diff)
ipmort_orig: pick best way to import upstream tarball automatically
Add new value --merge-mode=auto that selects either 'replace' or 'merge' depending on the source format version. Closes: #700411
Diffstat (limited to 'tests/24_test_gbp_import_orig.py')
-rw-r--r--tests/24_test_gbp_import_orig.py38
1 files changed, 37 insertions, 1 deletions
diff --git a/tests/24_test_gbp_import_orig.py b/tests/24_test_gbp_import_orig.py
index 4264e669..c7619c35 100644
--- a/tests/24_test_gbp_import_orig.py
+++ b/tests/24_test_gbp_import_orig.py
@@ -4,7 +4,9 @@
import os
import unittest
-from gbp.scripts.import_orig import (ImportOrigDebianGitRepository, GbpError)
+from collections import namedtuple
+
+from gbp.scripts.import_orig import (ImportOrigDebianGitRepository, GbpError, is_30_quilt)
from gbp.scripts.common.import_orig import download_orig
from . testutils import DebianGitTestRepo
@@ -69,3 +71,37 @@ class TestImportOrigDownload(DebianGitTestRepo):
url = "https://{host}/cgit/gbp/deb-testdata/tree/dsc-3.0/{pkg}".format(host=self.HOST,
pkg=pkg)
self.assertEqual(download_orig(url).path, '../%s' % pkg)
+
+
+class TestIs30Quilt(DebianGitTestRepo):
+ Options = namedtuple('Options', 'debian_branch')
+ format_file = 'debian/source/format'
+
+ def setUp(self):
+ DebianGitTestRepo.setUp(self)
+ os.chdir(self.repo.path)
+ os.makedirs('debian/source/')
+
+ def test_30_quilt(self):
+ options = self.Options(debian_branch='master')
+ with open(self.format_file, 'w') as f:
+ f.write('3.0 (quilt)\n')
+ self.repo.add_files([self.format_file])
+ self.repo.commit_all("Add %s" % self.format_file)
+ self.assertEquals(self.repo.branch, options.debian_branch)
+ self.assertTrue(is_30_quilt(self.repo, options))
+
+ def test_no_format(self):
+ options = self.Options(debian_branch='master')
+ self.assertFalse(os.path.exists(self.format_file))
+ self.assertFalse(is_30_quilt(self.repo, options))
+
+ def test_no_quilt(self):
+ options = self.Options(debian_branch='master')
+ with open(self.format_file, 'w') as f:
+ f.write('3.0 (nonexistent)')
+ self.assertFalse(is_30_quilt(self.repo, options))
+
+ def test_30_quilt_empty_repo(self):
+ options = self.Options(debian_branch='master')
+ self.assertFalse(is_30_quilt(self.repo, options))