def assertValidRecipients(self, user_list, group_list): recipient_list = mail.outbox[0].to + mail.outbox[0].cc self.assertEqual(len(recipient_list), len(user_list) + len(group_list)) for user in user_list: self.assert_(get_email_address_for_user( User.objects.get(username=user)) in recipient_list, u"user %s was not found in the recipient list" % user) groups = Group.objects.filter(name__in=group_list, local_site=None) for group in groups: for address in get_email_addresses_for_group(group): self.assert_(address in recipient_list, u"group %s was not found in the recipient list" % address)
def assertValidRecipients(self, user_list, group_list): recipient_list = mail.outbox[0].to + mail.outbox[0].cc self.assertEqual(len(recipient_list), len(user_list) + len(group_list)) for user in user_list: self.assert_(get_email_address_for_user( User.objects.get(username=user)) in recipient_list, u"user %s was not found in the recipient list" % user) groups = Group.objects.filter(name__in=group_list, local_site=None) for group in groups: for address in get_email_addresses_for_group(group): self.assert_(address in recipient_list, u"group %s was not found in the recipient list" % address)