This is the test that allowed me to reproduce the oops based on the team's history.
class TestTeamContactAddress(TestCaseWithFactory):
...
def test_setContactAddress_after_purged_mailing_list_and_rename(self):
# This is the rare case where a list is purged for a team rename,
# then the contact address is set/unset sometime afterwards.
# The old mailing list address belongs the the team, but not the list.
# 1. Create then purge a mailing list. list_address = self.createMailingListAndGetAddress() mailing_list = self.team.mailing_list mailing_list.deactivate() mailing_list.transitionToStatus(MailingListStatus.INACTIVE) mailing_list.purge() transaction.commit()
# 2. Rename the team. login_celebrity('admin') self.team.name = 'beta' login_person(self.team.teamowner)
# 3. Set the contact address. self.team.setContactAddress(None) self.assertEqual(None, self.team.preferredemail) self.assertEqual([], self.getAllEmailAddresses())
This is the test that allowed me to reproduce the oops based on the team's history.
class TestTeamContact Address( TestCaseWithFac tory): Address_ after_purged_ mailing_ list_and_ rename( self):
list_address = self.createMail ingListAndGetAd dress()
mailing_ list = self.team. mailing_ list
mailing_ list.deactivate ()
mailing_ list.transition ToStatus( MailingListStat us.INACTIVE)
mailing_ list.purge( )
transaction. commit( )
login_ celebrity( 'admin' )
self.team. name = 'beta'
login_ person( self.team. teamowner)
self.team. setContactAddre ss(None)
self.assertEqu al(None, self.team. preferredemail)
self.assertEqu al([], self.getAllEmai lAddresses( ))
...
def test_setContact
# This is the rare case where a list is purged for a team rename,
# then the contact address is set/unset sometime afterwards.
# The old mailing list address belongs the the team, but not the list.
# 1. Create then purge a mailing list.
# 2. Rename the team.
# 3. Set the contact address.