aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests/13_test_gbp_pq.py
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2015-02-08 15:15:03 +0100
committerGuido Günther <agx@sigxcpu.org>2015-02-08 16:29:13 +0100
commit62a5429093ab190a843d5fa7243227c1d799ca3e (patch)
treee64631355e7bfcd50ef8f2bfd8368a3d959428c1 /tests/13_test_gbp_pq.py
parent64be54db7546e7399b5b758d3f25c507180180e1 (diff)
parse_gbp_commands: support command filtering
When we write out patches to subdirs using a topic we want to filter out this topic from the commit message. Support for this was lost in 7ce15d2434ee42aa5a1afce3d03069c5efb2db1b add it back. Also fix parsing of the deprecated commands.
Diffstat (limited to 'tests/13_test_gbp_pq.py')
-rw-r--r--tests/13_test_gbp_pq.py27
1 files changed, 26 insertions, 1 deletions
diff --git a/tests/13_test_gbp_pq.py b/tests/13_test_gbp_pq.py
index c17b7151..46110b1c 100644
--- a/tests/13_test_gbp_pq.py
+++ b/tests/13_test_gbp_pq.py
@@ -1,5 +1,5 @@
# vim: set fileencoding=utf-8 :
-# (C) 2012 Guido Günther <agx@sigxcpu.org>
+# (C) 2012,2015 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
# the Free Software Foundation; either version 2 of the License, or
@@ -153,5 +153,30 @@ class TestExport(testutils.DebianGitTestRepo):
self.assertFalse(repo.has_branch(pq_branch))
+class TestParseGbpCommand(unittest.TestCase):
+ def test_empty_body(self):
+ """Test command filtering with an empty body"""
+ info = { 'body': '' }
+ (cmds, body) = pq.parse_gbp_commands(info, ['tag'], ['cmd1'], ['cmd2'])
+ self.assertEquals(cmds, {})
+ self.assertEquals(body, '')
+
+ def test_noarg_cmd(self):
+ orig_body = '\n'.join(["Foo",
+ "tag: cmd1"])
+ info = { 'body': orig_body }
+ (cmds, body) = pq.parse_gbp_commands(info, 'tag', ['cmd'], ['argcmd'])
+ self.assertEquals(cmds, {'cmd': None})
+ self.assertEquals(body, orig_body)
+
+ def test_filter_cmd(self):
+ orig_body = '\n'.join(["Foo",
+ "tag: cmd1"])
+ info = { 'body': orig_body }
+ (cmds, body) = pq.parse_gbp_commands(info, 'tag', ['cmd'], ['argcmd'], ['cmd'])
+ self.assertEquals(cmds, {'cmd': None})
+ self.assertEquals(body, 'Foo')
+
+
def _patch_path(name):
return os.path.join(context.projectdir, 'tests/data', name)