diff options
| author | Gurkirpal | 2016-03-15 19:03:21 +0530 |
|---|---|---|
| committer | Barry Warsaw | 2016-03-22 09:39:03 -0400 |
| commit | 75941917d8c57b41e2583079f22863326ebf9920 (patch) | |
| tree | 15a80a4c1e0aebe5cc5342cc757b9156063da46b /src/mailman/commands/tests | |
| parent | 472eb9765f4163aad785f483584ff607f01fdeeb (diff) | |
| download | mailman-75941917d8c57b41e2583079f22863326ebf9920.tar.gz mailman-75941917d8c57b41e2583079f22863326ebf9920.tar.zst mailman-75941917d8c57b41e2583079f22863326ebf9920.zip | |
Diffstat (limited to 'src/mailman/commands/tests')
| -rw-r--r-- | src/mailman/commands/tests/test_create.py | 19 |
1 files changed, 18 insertions, 1 deletions
diff --git a/src/mailman/commands/tests/test_create.py b/src/mailman/commands/tests/test_create.py index 67c58a13b..83a4dcb33 100644 --- a/src/mailman/commands/tests/test_create.py +++ b/src/mailman/commands/tests/test_create.py @@ -25,6 +25,7 @@ __all__ = [ import sys import unittest +from argparse import ArgumentParser from mailman.app.lifecycle import create_list from mailman.commands.cli_lists import Create from mailman.testing.layers import ConfigLayer @@ -55,7 +56,8 @@ class TestCreate(unittest.TestCase): def setUp(self): self.command = Create() - self.command.parser = FakeParser() + self.parser = ArgumentParser() + self.command.add(FakeParser(), self.parser) self.args = FakeArgs() def test_cannot_create_duplicate_list(self): @@ -90,3 +92,18 @@ class TestCreate(unittest.TestCase): pass self.assertEqual(self.command.parser.message, 'Illegal owner addresses: main=True') + + def test_without_domain_option(self): + # Domain should be created if option not specified. + args = self.parser.parse_args('test@list.org'.split()) + self.assertTrue(args.domain) + + def test_with_domain_option(self): + # Domain should be created if option given. + args = self.parser.parse_args('-d test@list.org'.split()) + self.assertTrue(args.domain) + + def test_with_nodomain_option(self): + # Domain should not be created if --no-domain is given. + args = self.parser.parse_args('-D test@list.net'.split()) + self.assertFalse(args.domain) |
