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

Commits:
cbad9cc7 by Barry Warsaw at 2017-07-07T16:07:40-04:00
Update test_import.py

- - - - -


1 changed file:

- src/mailman/commands/tests/test_import.py


Changes:

=====================================
src/mailman/commands/tests/test_import.py
=====================================
--- a/src/mailman/commands/tests/test_import.py
+++ b/src/mailman/commands/tests/test_import.py
@@ -19,26 +19,19 @@
 
 import unittest
 
+from click.testing import CliRunner
 from mailman.app.lifecycle import create_list
-from mailman.commands.cli_import import Import21
+from mailman.commands.cli_import import import_21
 from mailman.testing.layers import ConfigLayer
 from pkg_resources import resource_filename
 from unittest.mock import patch
 
 
-class FakeArgs:
-    listname = ['t...@example.com']
-    pickle_file = [
-        resource_filename('mailman.testing', 'config-with-instances.pck'),
-        ]
-
-
 class TestImport(unittest.TestCase):
     layer = ConfigLayer
 
     def setUp(self):
-        self.command = Import21()
-        self.args = FakeArgs()
+        self._command = CliRunner()
         self.mlist = create_list('t...@example.com')
 
     @patch('mailman.commands.cli_import.import_config_pck')
@@ -47,8 +40,10 @@ class TestImport(unittest.TestCase):
         # _BounceInfo instances.  We throw these away when importing to
         # Mailman 3, but we have to fake the instance's classes, otherwise
         # unpickling the dictionaries will fail.
+        pickle_file = resource_filename(
+            'mailman.testing', 'config-with-instances.pck')
         try:
-            self.command.process(self.args)
+            self._command.invoke(import_21, ('t...@example.com', pickle_file))
         except ImportError as error:
             self.fail('The pickle failed loading: {}'.format(error))
         self.assertTrue(import_config_pck.called)



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

---
View it on GitLab: 
https://gitlab.com/mailman/mailman/commit/cbad9cc756ba3469b79325b87039e1a7c3ea430c
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