def test_getRecipientPersons_to_user(self): # The recipient set only contains the user. sender = self.factory.makePerson() user = self.factory.makePerson(email='*****@*****.**') recipient_set = ContactViaWebNotificationRecipientSet(sender, user) self.assertContentEqual([('*****@*****.**', user)], list(recipient_set.getRecipientPersons()))
def test_getRecipientPersons_to_user(self): # The recipient set only contains the user. sender = self.factory.makePerson() user = self.factory.makePerson(email='*****@*****.**') recipient_set = ContactViaWebNotificationRecipientSet(sender, user) self.assertContentEqual( [('*****@*****.**', user)], list(recipient_set.getRecipientPersons()))
def test_getRecipientPersons_to_admins(self): # The recipient set only contains the team admins when the user # is not an admin of the team the user is contacting admin = self.factory.makePerson(email='*****@*****.**') member = self.factory.makePerson(email='*****@*****.**') team = self.factory.makeTeam(owner=admin, members=[member]) recipient_set = ContactViaWebNotificationRecipientSet(member, team) self.assertContentEqual([('*****@*****.**', admin)], list(recipient_set.getRecipientPersons()))
def test_getRecipientPersons_to_members(self): # The recipient set contains all the team members when the admin # is contacting the team. admin = self.factory.makePerson(email='*****@*****.**') member = self.factory.makePerson(email='*****@*****.**') team = self.factory.makeTeam(owner=admin, members=[member]) recipient_set = ContactViaWebNotificationRecipientSet(admin, team) self.assertContentEqual([('*****@*****.**', admin), ('*****@*****.**', member)], list(recipient_set.getRecipientPersons()))
def test_rationale_and_reason_user(self): sender = self.factory.makePerson() user = self.factory.makePerson(name='pting') recipient_set = ContactViaWebNotificationRecipientSet(sender, user) for email, recipient in recipient_set.getRecipientPersons(): reason, rationale = recipient_set.getReason(email) self.assertEqual( 'using the "Contact this user" link on your profile page\n' '(http://launchpad.dev/~pting)', reason) self.assertEqual('ContactViaWeb user', rationale)
def test_getRecipientPersons_to_members(self): # The recipient set contains all the team members when the admin # is contacting the team. admin = self.factory.makePerson(email='*****@*****.**') member = self.factory.makePerson(email='*****@*****.**') team = self.factory.makeTeam(owner=admin, members=[member]) recipient_set = ContactViaWebNotificationRecipientSet(admin, team) self.assertContentEqual( [('*****@*****.**', admin), ('*****@*****.**', member)], list(recipient_set.getRecipientPersons()))
def test_getRecipientPersons_to_admins(self): # The recipient set only contains the team admins when the user # is not an admin of the team the user is contacting admin = self.factory.makePerson(email='*****@*****.**') member = self.factory.makePerson(email='*****@*****.**') team = self.factory.makeTeam(owner=admin, members=[member]) recipient_set = ContactViaWebNotificationRecipientSet(member, team) self.assertContentEqual( [('*****@*****.**', admin)], list(recipient_set.getRecipientPersons()))
def test_rationale_and_reason_members(self): team = self.factory.makeTeam(name='pting') sender = team.teamowner recipient_set = ContactViaWebNotificationRecipientSet(sender, team) for email, recipient in recipient_set.getRecipientPersons(): reason, rationale = recipient_set.getReason(email) self.assertEqual( 'to each member of the Pting team using the ' '"Contact this team" link on the Pting team page\n' '(http://launchpad.dev/~pting)', reason) self.assertEqual('ContactViaWeb member (pting team)', rationale)
def test_rationale_and_reason_admin(self): sender = self.factory.makePerson() team = self.factory.makeTeam(name='pting') recipient_set = ContactViaWebNotificationRecipientSet(sender, team) for email, recipient in recipient_set.getRecipientPersons(): reason, rationale = recipient_set.getReason(email) self.assertEqual( 'using the "Contact this team\'s admins" link ' 'on the Pting team page\n' '(http://launchpad.dev/~pting)', reason) self.assertEqual('ContactViaWeb owner (pting team)', rationale)