[Reportbug-commits] [SCM] Reportbug - reports bugs in the Debian distribution branch, master, updated. 6.0-43-g2b254c9
Sandro Tosi
morph at debian.org
Sun Aug 28 13:36:03 UTC 2011
The following commit has been merged in the master branch:
commit d08ffbdaf5e9c05d8c99ae77f0e73a0d57c54b30
Author: Sandro Tosi <morph at debian.org>
Date: Sun Aug 28 14:44:26 2011 +0200
complete coverage of utils.parse_config_files()
diff --git a/test/data/reportbug.conf b/test/data/reportbug.conf
new file mode 100644
index 0000000..561b3bd
--- /dev/null
+++ b/test/data/reportbug.conf
@@ -0,0 +1,38 @@
+severity normal
+bts debian
+submit
+mutt
+header "X-Reportbug-Testsuite: this is the test suite"
+query-bts
+check-available
+cc
+config-files
+compress
+# all possible 'sign' values
+sign gnupg
+sign none
+sign gpg
+keyid deadbeef
+email "reportbug-maint at lists.alioth.debian.org"
+realname "Reportbug Maintainers"
+replyto "We dont care <dev at null.org>"
+http_proxy http://proxy.example.com:3128/
+smtphost reportbug.debian.org:587
+smtpuser Bond
+smtppasswd "James Bond"
+smtptls
+mta /usr/sbin/sendmail
+ui gtk2
+editor "emacs -nw"
+template
+no-query-source
+no-debconf
+verify
+offline
+mode novice
+no-check-uid
+mbox_reader_cmd "mutt -f %s"
+mirror this_is_a_bts_mirror
+paranoid
+max_attachment_size 1024000
+reportbug_version 6.2
diff --git a/test/test_utils.py b/test/test_utils.py
index b44755c..84db634 100644
--- a/test/test_utils.py
+++ b/test/test_utils.py
@@ -383,19 +383,59 @@ Shell: /bin/sh linked to /bin/bash"""
class TestConfig(unittest2.TestCase):
-# Find a way to specify an "internal" file for testing
-# def setUp(self):
-# self._FILES = utils.FILES
-# utils.FILES = os.path.dirname(__file__) + '/data/reportbugrc'
-#
-# def tearDown(self):
-# utils.FILES = self._FILES
-#
-# --> check the code in utils.parse_config_files to get all the checked params
+ # Use an "internal" file for testing
+ def setUp(self):
+ self._FILES = utils.FILES
+ utils.FILES = [os.path.dirname(__file__) + '/data/reportbug.conf']
+
+ def tearDown(self):
+ utils.FILES = self._FILES
def test_parse_config_files(self):
+
+ desired_conf = {
+ 'bts': 'debian',
+ 'check_available': True,
+ 'check_uid': False,
+ 'debconf': False,
+ 'dontquery': False,
+ 'editor': u'emacs -nw',
+ 'email': u'reportbug-maint at lists.alioth.debian.org',
+ 'headers': ['X-Reportbug-Testsuite: this is the test suite'],
+ 'http_proxy': u'http://proxy.example.com:3128/',
+ 'interface': 'gtk2',
+ 'keyid': u'deadbeef',
+ 'max_attachment_size': 1024000,
+ 'mbox_reader_cmd': u'mutt -f %s',
+ 'mirrors': ['this_is_a_bts_mirror'],
+ 'mode': 'novice',
+ 'mta': u'/usr/sbin/sendmail',
+ 'nocc': False,
+ 'nocompress': False,
+ 'noconf': False,
+ 'offline': True,
+ 'paranoid': True,
+ 'query_src': False,
+ 'realname': u'Reportbug Maintainers',
+ 'replyto': u'We dont care <dev at null.org>',
+ 'sendto': 'submit',
+ 'severity': 'normal',
+ 'sign': 'gpg',
+ 'smtphost': u'reportbug.debian.org:587',
+ 'smtppasswd': u'James Bond',
+ 'smtptls': True,
+ 'smtpuser': u'Bond',
+ 'template': True,
+ 'verify': True}
+
args = utils.parse_config_files()
- self.assertIsNot(args, {})
+ for conf in desired_conf:
+ self.assertIn(conf, args)
+ self.assertEqual(desired_conf[conf], args[conf])
+
+ # mua returns an instance of utils.Mua, need to check differently
+ self.assertIn('mua', args)
+ self.assertIsInstance(args['mua'], utils.Mua)
def test_bts579891(self):
lex = utils.our_lex('realname "Paul \\"TBBle\\" Hampson"', posix=True)
--
Reportbug - reports bugs in the Debian distribution
More information about the Reportbug-commits
mailing list