← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~lgp171188/launchpad:fix-has-assigned-this-bug-to-you into launchpad:master

 


Diff comments:

> diff --git a/lib/lp/bugs/tests/test_bugchanges.py b/lib/lp/bugs/tests/test_bugchanges.py
> index 148e329..b2999af 100644
> --- a/lib/lp/bugs/tests/test_bugchanges.py
> +++ b/lib/lp/bugs/tests/test_bugchanges.py
> @@ -1842,3 +1848,48 @@ class TestBugChanges(TestCaseWithFactory):
>          # self.product_metadata_subscriber is not included among the
>          # recipients.
>          self.assertRecipients([self.user])
> +
> +    @patch('lp.bugs.subscribers.bug.sendmail')
> +    def test_bugtask_subscription_email_mentions_the_user(
> +            self,
> +            mocked_sendmail):
> +        # When a bugtask is assigned to a user, verify that the email
> +        # notifications to the user mentions that the bug was assigned
> +        # to the them directly.
> +        user = self.factory.makePerson(
> +            displayname='New user', selfgenerated_bugnotifications=True)
> +
> +        with notify_modified(self.bug_task, ['assignee'], user=self.user):
> +            self.bug_task.transitionToAssignee(user)
> +        expected_message = (
> +            '{} ({}) has assigned this bug to you'.format(
> +                self.user.displayname, self.user.name
> +            )
> +        )
> +        email_body = self.getEmailBodyFromMessage(
> +            mocked_sendmail.call_args[0][0])
> +        self.assertThat(email_body, StartsWith(expected_message))
> +
> +    @patch('lp.bugs.subscribers.bug.sendmail')
> +    def test_team_membership_subscription_email_mentions_the_team(
> +            self,
> +            mocked_sendmail):
> +        # When a bugtask is assigned to a team, verify that the email
> +        # notifications to the team members mentions that the bug was assigned

mentions -> mention

> +        # to the team instead of them directly.
> +        user = self.factory.makePerson(
> +            displayname='New user', selfgenerated_bugnotifications=True)
> +        team = self.factory.makeTeam()
> +        team.addMember(user, team.teamowner)
> +
> +        with notify_modified(self.bug_task, ['assignee'], user=user):
> +            self.bug_task.transitionToAssignee(team)
> +        expected_message = (
> +            '{} ({}) has assigned this bug to your team "{}" for {}'.format(
> +                user.displayname, user.name, team.displayname,
> +                self.bug_task.target.displayname
> +            )
> +        )
> +        email_body = self.getEmailBodyFromMessage(
> +            mocked_sendmail.call_args[0][0])
> +        self.assertThat(email_body, StartsWith(expected_message))


-- 
https://code.launchpad.net/~lgp171188/launchpad/+git/launchpad/+merge/411682
Your team Launchpad code reviewers is requested to review the proposed merge of ~lgp171188/launchpad:fix-has-assigned-this-bug-to-you into launchpad:master.



References