diff options
| author | Barry Warsaw | 2016-03-24 15:12:45 -0400 |
|---|---|---|
| committer | Barry Warsaw | 2016-03-24 15:12:45 -0400 |
| commit | d964be9f9a141772bb0538f7bc7ecfbf83950a02 (patch) | |
| tree | ac64133d73352829e5d58deb3f7553098ae12f4b /src/mailman/commands/tests/test_create.py | |
| parent | 8cc7e77b85f013d6f9ea4cda16ae18856fd6ccee (diff) | |
| download | mailman-d964be9f9a141772bb0538f7bc7ecfbf83950a02.tar.gz mailman-d964be9f9a141772bb0538f7bc7ecfbf83950a02.tar.zst mailman-d964be9f9a141772bb0538f7bc7ecfbf83950a02.zip | |
Diffstat (limited to 'src/mailman/commands/tests/test_create.py')
| -rw-r--r-- | src/mailman/commands/tests/test_create.py | 20 |
1 files changed, 4 insertions, 16 deletions
diff --git a/src/mailman/commands/tests/test_create.py b/src/mailman/commands/tests/test_create.py index 97a8d895e..392dbdbb2 100644 --- a/src/mailman/commands/tests/test_create.py +++ b/src/mailman/commands/tests/test_create.py @@ -17,21 +17,16 @@ """Test the `mailman create` subcommand.""" -__all__ = [ - 'TestCreate', - ] - - import sys import unittest from argparse import ArgumentParser +from contextlib import suppress from mailman.app.lifecycle import create_list from mailman.commands.cli_lists import Create from mailman.testing.layers import ConfigLayer - class FakeArgs: language = None owners = [] @@ -50,7 +45,6 @@ class FakeParser: sys.exit(1) - class TestCreate(unittest.TestCase): layer = ConfigLayer @@ -63,20 +57,16 @@ class TestCreate(unittest.TestCase): # Cannot create a mailing list if it already exists. create_list('test@example.com') self.args.listname = ['test@example.com'] - try: + with suppress(SystemExit): self.command.process(self.args) - except SystemExit: - pass self.assertEqual(self.command.parser.message, 'List already exists: test@example.com') def test_invalid_posting_address(self): # Cannot create a mailing list with an invalid posting address. self.args.listname = ['foo'] - try: + with suppress(SystemExit): self.command.process(self.args) - except SystemExit: - pass self.assertEqual(self.command.parser.message, 'Illegal list name: foo') @@ -84,10 +74,8 @@ class TestCreate(unittest.TestCase): # Cannot create a list with invalid owner addresses. LP: #778687 self.args.listname = ['test@example.com'] self.args.owners = ['main=True'] - try: + with suppress(SystemExit): self.command.process(self.args) - except SystemExit: - pass self.assertEqual(self.command.parser.message, 'Illegal owner addresses: main=True') |
