Skip to content

Commit 407aae8

Browse files
committed
Add test for config parse error by running AdminTool.
1 parent aad8e82 commit 407aae8

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

test/test_config.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,20 @@ def testConfigValueInterpolateError(self):
586586
self.assertIn("_test_instance/config.ini with section [main] at option admin_email", cm.exception.args[0])
587587

588588

589+
from roundup.admin import AdminTool
590+
from .test_admin import captured_output
591+
592+
admin=AdminTool()
593+
with captured_output() as (out, err):
594+
sys.argv=['main', '-i', self.dirname, 'get', 'tile', 'issue1']
595+
ret = admin.main()
596+
597+
expected_err = "Error in _test_instance/config.ini with section [main] at option admin_email: '%' must be followed by '%' or '(', found: '% is invalid'"
598+
599+
self.assertEqual(ret, 1)
600+
out = out.getvalue().strip()
601+
self.assertEqual(out, expected_err)
602+
589603
def testInvalidIndexerValue(self):
590604
""" Mistype native indexer. Verify exception is
591605
generated.
@@ -609,5 +623,3 @@ def testInvalidIndexerValue(self):
609623
print(string_rep)
610624
self.assertIn("nati", string_rep)
611625
self.assertIn("'whoosh'", string_rep)
612-
613-

0 commit comments

Comments
 (0)