class TestLeave(unittest.TestCase): layer = ConfigLayer def setUp(self): self._mlist = create_list('*****@*****.**') self._command = Leave() def test_confirm_leave_not_a_member(self): self._mlist.unsubscription_policy = SubscriptionPolicy.confirm # Try to unsubscribe someone who is not a member. Anne is a real # user, with a validated address, but she is not a member of the # mailing list. anne = getUtility(IUserManager).create_user('*****@*****.**') set_preferred(anne) # Initiate an unsubscription. msg = Message() msg['From'] = '*****@*****.**' results = Results() self._command.process(self._mlist, msg, {}, (), results) self.assertEqual( str(results).splitlines()[-1], 'leave: [email protected] is not a member of [email protected]')
def setUp(self): self._mlist = create_list('*****@*****.**') self._command = Leave()