def setUp(self):
     super(TestNotificationsSentForBugExpiration, self).setUp(
         user='******')
     # We need a product, a bug for this product, a question linked
     # to the bug and a subscriber.
     self.product = self.factory.makeProduct()
     self.bug = self.factory.makeBug(target=self.product)
     question = self.factory.makeQuestion(target=self.product)
     self.subscriber = self.factory.makePerson()
     question.subscribe(self.subscriber)
     question.linkBug(self.bug)
     # Flush pending jobs for question creation.
     pop_questionemailjobs()
     switch_dbuser(config.malone.expiration_dbuser)
 def setUp(self):
     super(TestNotificationsSentForBugExpiration,
           self).setUp(user='******')
     # We need a product, a bug for this product, a question linked
     # to the bug and a subscriber.
     self.product = self.factory.makeProduct()
     self.bug = self.factory.makeBug(target=self.product)
     question = self.factory.makeQuestion(target=self.product)
     self.subscriber = self.factory.makePerson()
     question.subscribe(self.subscriber)
     question.linkBug(self.bug)
     # Flush pending jobs for question creation.
     pop_questionemailjobs()
     switch_dbuser(config.malone.expiration_dbuser)
Exemplo n.º 3
0
 def test_notifications_for_question_subscribers(self):
     # Ensure that notifications are sent to subscribers of a
     # question linked to the expired bug.
     bugtask = self.bug.default_bugtask
     with notify_modified(bugtask, ["status"]):
         bugtask.transitionToStatus(BugTaskStatus.EXPIRED,
                                    self.product.owner)
     recipients = [
         job.metadata['recipient_set'] for job in pop_questionemailjobs()
     ]
     self.assertContentEqual(['ASKER_SUBSCRIBER'], recipients)
 def test_notifications_for_question_subscribers(self):
     # Ensure that notifications are sent to subscribers of a
     # question linked to the expired bug.
     bugtask = self.bug.default_bugtask
     bugtask_before_modification = Snapshot(bugtask, providing=IBugTask)
     bugtask.transitionToStatus(BugTaskStatus.EXPIRED, self.product.owner)
     bug_modified = ObjectModifiedEvent(
         bugtask, bugtask_before_modification, ["status"])
     notify(bug_modified)
     recipients = [
         job.metadata['recipient_set'] for job in pop_questionemailjobs()]
     self.assertContentEqual(
         ['ASKER_SUBSCRIBER'], recipients)
 def test_notifications_for_question_subscribers(self):
     # Ensure that notifications are sent to subscribers of a
     # question linked to the expired bug.
     bugtask = self.bug.default_bugtask
     bugtask_before_modification = Snapshot(bugtask, providing=IBugTask)
     bugtask.transitionToStatus(BugTaskStatus.EXPIRED, self.product.owner)
     bug_modified = ObjectModifiedEvent(bugtask,
                                        bugtask_before_modification,
                                        ["status"])
     notify(bug_modified)
     recipients = [
         job.metadata['recipient_set'] for job in pop_questionemailjobs()
     ]
     self.assertContentEqual(['ASKER_SUBSCRIBER'], recipients)