Exemple #1
0
    def test_can_email_hypothesis_evidence_digest(self):
        """Test that we can email a digest containing new hypotheses and evidence."""
        for x in [1, 2]:
            board = create_board(board_title="Board #{}".format(x), days=0)
            BoardFollower.objects.create(
                board=board, user=self.daily,
            )
            hypothesis = Hypothesis.objects.create(
                board=board,
                hypothesis_text="Hypothesis #{}".format(x),
                creator=self.weekly,
            )
            evidence = Evidence.objects.create(
                board=board,
                evidence_desc="Evidence #{}".format(x),
                creator=self.weekly,
            )
            notify_add(board, self.weekly, hypothesis)
            notify_add(board, self.weekly, evidence)

        succeeded, passed, failed = send_digest_emails(DigestFrequency.daily)
        self.assertEqual(succeeded, 1)
        self.assertEqual(len(mail.outbox), 1, "No digest email sent")
        txt_body = mail.outbox[0].body
        logger.info(txt_body)

        for x in [1, 2]:
            self.assertTrue("Board #{}".format(x) in txt_body)
            self.assertTrue("Hypothesis #{}".format(x) in txt_body)
            self.assertTrue("Evidence #{}".format(x) in txt_body)
Exemple #2
0
 def test_board_evidence_notifications(self):
     """Test the add/edit evidence notifications work render reasonably."""
     evidence = Evidence.objects.create(
         board=self.board,
         evidence_desc='Evidence',
     )
     notify_add(self.board, self.other, evidence)
     notify_edit(self.board, self.other, evidence)
     self.login()
     response = self.client.get(reverse('openach:notifications'))
     self.assertContains(response, self.other.username, count=2)
     self.assertContains(response, self.board.board_title, count=2)
     self.assertContains(response, 'edited evidence', count=1)
     self.assertContains(response, 'added evidence', count=1)
Exemple #3
0
 def test_board_hypothesis_notifications(self):
     """Test the add/edit hypothesis notifications work render reasonably."""
     hypothesis = Hypothesis.objects.create(
         board=self.board,
         hypothesis_text='Hypothesis',
     )
     notify_add(self.board, self.other, hypothesis)
     notify_edit(self.board, self.other, hypothesis)
     self.login()
     response = self.client.get(reverse('openach:notifications'))
     self.assertContains(response, self.other.username, count=2)
     self.assertContains(response, self.board.board_title, count=2)
     self.assertContains(response, 'edited hypothesis', count=1)
     self.assertContains(response, 'added hypothesis', count=1)