[Bug 1432239] Re: Lists cannot be deleted if the have acceptable alias records

Barry Warsaw 1432239 at bugs.launchpad.net
Sun Mar 15 20:44:37 CET 2015

I think this is a real bug.  I think you're right that a new
ListDeletingEvent should be added to clear out any aliases for the
mailing list.  I actually tried to write a test for this in
src/mailman/model/tests/test_mailinglist.py but the
AceptableAliasSet.add() method doesn't seem to add the record to the
acceptablealias table.

class TestAcceptableAliases(unittest.TestCase):
    layer = ConfigLayer

    def setUp(self):
        self._mlist = create_list('ant at example.com')

    def test_delete_list_with_acceptable_aliases(self):
        # LP: #1432239 - deleting a mailing list with acceptable aliases
        # causes a SQLAlchemy error.  The aliases must be deleted first.
        alias_set = IAcceptableAliasSet(self._mlist)
        alias_set.add('bee at example.com')
        self.assertEqual(['bee at example.com'],
                         [alias.alias for alias in alias_set.aliases])
        self.assertEqual(len(alias.alias for alias in alias_set.aliases), 0)

$ .tox/py34/bin/python -m nose2 -P test_delete_list_with_acceptable_aliases
FAIL: test_delete_list_with_acceptable_aliases (mailman.model.tests.test_mailinglist.TestAcceptableAliases)
Traceback (most recent call last):
  File "/home/barry/projects/mailman/lp1432239/src/mailman/model/tests/test_mailinglist.py", line 162, in test_delete_list_with_acceptable_aliases
    [alias.alias for alias in alias_set.aliases])
AssertionError: Lists differ: ['bee at example.com'] != []

First list contains 1 additional elements.
First extra element 0:
bee at example.com

- ['bee at example.com']
+ []

Ran 1 test in 0.173s

FAILED (failures=1)

I'd rather not add an explicit commit here because IIUC, it isn't necessary in other model layer tests.  I think if the test can be made to fail, the fix should be easy.

** Changed in: mailman
       Status: New => Triaged

** Changed in: mailman
    Milestone: None => 3.0.0b6

You received this bug notification because you are a member of Mailman
Coders, which is subscribed to GNU Mailman.

  Lists cannot be deleted if the have acceptable alias records

To manage notifications about this bug go to:

More information about the Mailman-coders mailing list