Barry Warsaw pushed to branch click-cli at mailman / Mailman Core
Commits:
1edece0b by Barry Warsaw at 2017-07-18T15:33:15-04:00
Boost coverage.
- - - - -
2 changed files:
- src/mailman/commands/cli_inject.py
- src/mailman/commands/tests/test_cli_inject.py
Changes:
=====================================
src/mailman/commands/cli_inject.py
=====================================
--- a/src/mailman/commands/cli_inject.py
+++ b/src/mailman/commands/cli_inject.py
@@ -65,12 +65,12 @@ def show_queues(ctx, param, value):
Additional metadata key/value pairs to add to the message metadata
dictionary. Use the format key=value. Multiple -m options are
allowed."""))
[email protected]('listname')
[email protected]('listspec')
@click.pass_context
-def inject(ctx, queue, message_file, keywords, listname):
- mlist = getUtility(IListManager).get(listname)
+def inject(ctx, queue, message_file, keywords, listspec):
+ mlist = getUtility(IListManager).get(listspec)
if mlist is None:
- ctx.fail(_('No such list: $listname'))
+ ctx.fail(_('No such list: $listspec'))
queue_name = ('in' if queue is None else queue)
switchboard = config.switchboards.get(queue_name)
if switchboard is None:
=====================================
src/mailman/commands/tests/test_cli_inject.py
=====================================
--- a/src/mailman/commands/tests/test_cli_inject.py
+++ b/src/mailman/commands/tests/test_cli_inject.py
@@ -47,3 +47,20 @@ class TestInject(unittest.TestCase):
input=InterruptRaisingReader())
self.assertEqual(results.exit_code, 1)
self.assertEqual(results.output, 'Interrupted\n')
+
+ def test_inject_no_such_list(self):
+ result = self._command.invoke(inject, ('bee.example.com',))
+ self.assertEqual(result.exit_code, 2)
+ self.assertEqual(
+ result.output,
+ 'Usage: inject [OPTIONS] LISTSPEC\n\n'
+ 'Error: No such list: bee.example.com\n')
+
+ def test_inject_no_such_queue(self):
+ result = self._command.invoke(
+ inject, ('--queue', 'bogus', 'ant.example.com'))
+ self.assertEqual(result.exit_code, 2)
+ self.assertEqual(
+ result.output,
+ 'Usage: inject [OPTIONS] LISTSPEC\n\n'
+ 'Error: No such queue: bogus\n')
View it on GitLab:
https://gitlab.com/mailman/mailman/commit/1edece0bf884a9642d07db014feabfbf5d6e3f3f
---
View it on GitLab:
https://gitlab.com/mailman/mailman/commit/1edece0bf884a9642d07db014feabfbf5d6e3f3f
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list
[email protected]
Unsubscribe:
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org