def test_preapproved_messages_are_always_accepted(self): # An approved message is accepted even if the email address is # unknown. message = self.makeMailmanMessage( self.mm_list, '*****@*****.**', 'subject', 'any content.') msg_data = dict(approved=True) silence = LaunchpadMember.process(self.mm_list, message, msg_data) self.assertEqual(None, silence)
def test_preapproved_messages_are_always_accepted(self): # An approved message is accepted even if the email address is # unknown. message = self.makeMailmanMessage(self.mm_list, '*****@*****.**', 'subject', 'any content.') msg_data = dict(approved=True) silence = LaunchpadMember.process(self.mm_list, message, msg_data) self.assertEqual(None, silence)
def test_messages_from_launchpad_users_are_accepted(self): # A message from a launchpad user is accepted. lp_user_email = '*****@*****.**' lp_user = self.factory.makePerson(email=lp_user_email) message = self.makeMailmanMessage( self.mm_list, lp_user_email, 'subject', 'any content.') msg_data = {} silence = LaunchpadMember.process(self.mm_list, message, msg_data) self.assertEqual(None, silence)
def test_messages_from_launchpad_users_are_accepted(self): # A message from a launchpad user is accepted. lp_user_email = '*****@*****.**' self.factory.makePerson(email=lp_user_email) message = self.makeMailmanMessage(self.mm_list, lp_user_email, 'subject', 'any content.') msg_data = {} silence = LaunchpadMember.process(self.mm_list, message, msg_data) self.assertEqual(None, silence)
def test_messages_from_launchpad_itself_are_accepted(self): # A message from launchpad itself is accepted. Launchpad will sent # a secret. message = self.makeMailmanMessage( self.mm_list, '*****@*****.**', 'subject', 'any content.') message['message-id'] = 'hamster.hamster' hash = hashlib.sha1(mm_cfg.LAUNCHPAD_SHARED_SECRET) hash.update(message['message-id']) message['x-launchpad-hash'] = hash.hexdigest() msg_data = {} silence = LaunchpadMember.process(self.mm_list, message, msg_data) self.assertEqual(None, silence) self.assertEqual(True, msg_data['approved'])
def test_messages_from_launchpad_itself_are_accepted(self): # A message from launchpad itself is accepted. Launchpad will sent # a secret. message = self.makeMailmanMessage(self.mm_list, '*****@*****.**', 'subject', 'any content.') message['message-id'] = 'hamster.hamster' hash = hashlib.sha1(mm_cfg.LAUNCHPAD_SHARED_SECRET) hash.update(message['message-id']) message['x-launchpad-hash'] = hash.hexdigest() msg_data = {} silence = LaunchpadMember.process(self.mm_list, message, msg_data) self.assertEqual(None, silence) self.assertEqual(True, msg_data['approved'])