aboutsummaryrefslogtreecommitdiffhomepage
path: root/tests
diff options
context:
space:
mode:
authorGuido Günther <agx@sigxcpu.org>2012-02-13 19:00:43 +0100
committerGuido Günther <agx@sigxcpu.org>2012-02-13 19:50:35 +0100
commitaa2c06d3882d56cc372756c1ce83e09ab9085c0a (patch)
tree387a5c021df586960668bb830c1fa6a9d5d5211f /tests
parent4a8db7a62af7a7834c62d0e389ac4b2178fb44ce (diff)
gbp.config: Add tests
Git-Dch: Ignore
Diffstat (limited to 'tests')
-rw-r--r--tests/test_Config.py59
1 files changed, 59 insertions, 0 deletions
diff --git a/tests/test_Config.py b/tests/test_Config.py
new file mode 100644
index 00000000..7d4ba342
--- /dev/null
+++ b/tests/test_Config.py
@@ -0,0 +1,59 @@
+# vim: set fileencoding=utf-8 :
+
+"""
+Test L{gbp.config.GbpOptionParser}
+Test L{gbp.config.GbpOptionParserDebian}
+"""
+
+def test_option_parser():
+ """
+ Methods tested:
+ - L{gbp.config.GbpOptionParser.add_config_file_option}
+ - L{gbp.config.GbpOptionParser.add_boolean_config_file_option}
+
+ >>> import gbp.config
+ >>> c = gbp.config.GbpOptionParser('common', prefix='test')
+ >>> c.add_config_file_option(option_name='upstream-branch', dest='upstream')
+ >>> c.add_boolean_config_file_option(option_name='overlay', dest='overlay')
+ >>> c.add_boolean_config_file_option(option_name='track', dest='track')
+ """
+
+def test_option_parser_debian():
+ """
+ Methods tested:
+ - L{gbp.config.GbpOptionParserDebian.add_config_file_option}
+
+ >>> import gbp.config
+ >>> c = gbp.config.GbpOptionParserDebian('debian')
+ >>> c.add_config_file_option(option_name='builder', dest='builder')
+ Traceback (most recent call last):
+ ...
+ KeyError: 'builder'
+ >>> c.add_config_file_option(option_name='builder', dest='builder', help='foo')
+ """
+
+def test_option_group():
+ """
+ Methods tested:
+ - L{gbp.config.GbpOptionGroup.add_config_file_option}
+ - L{gbp.config.GbpOptionGroup.add_boolean_config_file_option}
+
+ >>> import gbp.config
+ >>> c = gbp.config.GbpOptionParser('debian')
+ >>> g = gbp.config.GbpOptionGroup(c, 'wheezy')
+ >>> g.add_config_file_option(option_name='debian-branch', dest='branch')
+ >>> g.add_boolean_config_file_option(option_name='track', dest='track')
+ """
+
+def test_tristate():
+ """
+ Methods tested:
+ - L{gbp.config.GbpOptionParser.add_config_file_option}
+
+ >>> import gbp.config
+ >>> c = gbp.config.GbpOptionParser('tristate')
+ >>> c.add_config_file_option(option_name="color", dest="color", type='tristate')
+ >>> options, args= c.parse_args(['--color=auto'])
+ >>> options.color
+ auto
+ """