Barry Warsaw pushed to branch click-cli at mailman / Mailman Core

Commits:
b254dfa1 by Barry Warsaw at 2017-07-18T15:41:04-04:00
Boost coverage.

- - - - -


2 changed files:

- src/mailman/commands/cli_withlist.py
- src/mailman/commands/tests/test_cli_shell.py


Changes:

=====================================
src/mailman/commands/cli_withlist.py
=====================================
--- a/src/mailman/commands/cli_withlist.py
+++ b/src/mailman/commands/cli_withlist.py
@@ -266,7 +266,7 @@ def shell(ctx, interactive, run, listspec, run_args):
         # without the dot is allowed.
         dotted_name = (run if '.' in run else '{0}.{0}'.format(run))
         if listspec is None:
-            ctx.fail(_('--run requires a mailing list name'))
+            ctx.fail(_('--run requires a mailing list'))
         # Parse the run arguments so we can pass them into the run method.
         if listspec.startswith('^'):
             r = {}


=====================================
src/mailman/commands/tests/test_cli_shell.py
=====================================
--- a/src/mailman/commands/tests/test_cli_shell.py
+++ b/src/mailman/commands/tests/test_cli_shell.py
@@ -126,10 +126,10 @@ class TestShell(unittest.TestCase):
             'ipython is not available, set use_ipython to no\n')
 
     def test_regex_without_run(self):
-        result = self._command.invoke(shell, ('-l', '^.*example.com'))
-        self.assertEqual(result.exit_code, 2)
+        results = self._command.invoke(shell, ('-l', '^.*example.com'))
+        self.assertEqual(results.exit_code, 2)
         self.assertEqual(
-            result.output,
+            results.output,
             'Usage: shell [OPTIONS] [RUN_ARGS]...\n\n'
             'Error: Regular expression requires --run\n')
 
@@ -148,9 +148,26 @@ class TestShell(unittest.TestCase):
             "The variable 'm' is the ant.example.com mailing list")
 
     def test_listspec_without_run_no_such_list(self):
-        result = self._command.invoke(shell, ('-l', 'ant.example.com'))
-        self.assertEqual(result.exit_code, 2)
+        results = self._command.invoke(shell, ('-l', 'ant.example.com'))
+        self.assertEqual(results.exit_code, 2)
         self.assertEqual(
-            result.output,
+            results.output,
             'Usage: shell [OPTIONS] [RUN_ARGS]...\n\n'
             'Error: No such list: ant.example.com\n')
+
+    def test_run_without_listspec(self):
+        results = self._command.invoke(shell, ('--run', 'something'))
+        self.assertEqual(results.exit_code, 2)
+        self.assertEqual(
+            results.output,
+            'Usage: shell [OPTIONS] [RUN_ARGS]...\n\n'
+            'Error: --run requires a mailing list\n')
+
+    def test_run_bogus_listspec(self):
+        results = self._command.invoke(
+            shell, ('-l', 'bee.example.com', '--run', 'something'))
+        self.assertEqual(results.exit_code, 2)
+        self.assertEqual(
+            results.output,
+            'Usage: shell [OPTIONS] [RUN_ARGS]...\n\n'
+            'Error: No such list: bee.example.com\n')



View it on GitLab: 
https://gitlab.com/mailman/mailman/commit/b254dfa13f13636b3062b3306649b422189d28dd

---
View it on GitLab: 
https://gitlab.com/mailman/mailman/commit/b254dfa13f13636b3062b3306649b422189d28dd
You're receiving this email because of your account on gitlab.com.
_______________________________________________
Mailman-checkins mailing list
Mailman-checkins@python.org
Unsubscribe: 
https://mail.python.org/mailman/options/mailman-checkins/archive%40jab.org

Reply via email to