diff options
Diffstat (limited to 'src/mailman/model/tests/test_bans.py')
| -rw-r--r-- | src/mailman/model/tests/test_bans.py | 46 |
1 files changed, 46 insertions, 0 deletions
diff --git a/src/mailman/model/tests/test_bans.py b/src/mailman/model/tests/test_bans.py new file mode 100644 index 000000000..a7ff8ed4f --- /dev/null +++ b/src/mailman/model/tests/test_bans.py @@ -0,0 +1,46 @@ +# Copyright (C) 2013-2016 by the Free Software Foundation, Inc. +# +# This file is part of GNU Mailman. +# +# GNU Mailman is free software: you can redistribute it and/or modify it under +# the terms of the GNU General Public License as published by the Free +# Software Foundation, either version 3 of the License, or (at your option) +# any later version. +# +# GNU Mailman is distributed in the hope that it will be useful, but WITHOUT +# ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or +# FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for +# more details. +# +# You should have received a copy of the GNU General Public License along with +# GNU Mailman. If not, see <http://www.gnu.org/licenses/>. + +"""Test Bans and the ban manager.""" + +__all__ = [ + 'TestMailingListBans', + ] + + +import unittest + +from mailman.app.lifecycle import create_list +from mailman.interfaces.bans import IBanManager +from mailman.interfaces.listmanager import IListManager +from mailman.testing.layers import ConfigLayer +from zope.component import getUtility + + + +class TestMailingListBans(unittest.TestCase): + layer = ConfigLayer + + def setUp(self): + self._mlist = create_list('ant@example.com') + self._manager = IBanManager(self._mlist) + + def test_delete_list(self): + # All list bans must be deleted when the list is deleted + self._manager.ban("anne@example.com") + getUtility(IListManager).delete(self._mlist) + self.assertEqual(len(list(self._manager)), 0) |
