def test_reopen_a_closed_bug(self): bug = BugFactory(status=False) edit_bug_data = { 'bug': bug.pk, 'text': 'Reopen the bug.', 'action': 'reopen' } redirect_url = reverse('bugs-get', args=[bug.pk]) response = self.client.post(self.comment_bug_url, edit_bug_data, follow=True) self.assertContains(response, markdown2html(_('*bug reopened*'))) self.assertContains(response, 'Reopen the bug.') self.assertRedirects(response, redirect_url) bug.refresh_from_db() self.assertTrue(bug.status)
def test_notify_assignee_on_bug_creation(self, send_mail): assignee = UserFactory() bug = BugFactory(assignee=assignee) expected_subject = _('NEW: Bug #{} - {}').format(bug.pk, bug.summary) expected_body = render_to_string('email/post_bug_save/email.txt', {'bug': bug}) expected_recipients = [assignee.email] send_mail.assert_called_once_with(settings.EMAIL_SUBJECT_PREFIX + expected_subject, expected_body, settings.DEFAULT_FROM_EMAIL, expected_recipients, fail_silently=False)
def test_user_sees_bugs(self): bug_1 = BugFactory() bug_2 = BugFactory() self.case_run_1.add_bug(bug_1.bug_id, bug_1.bug_system.pk) self.case_run_1.add_bug(bug_2.bug_id, bug_2.bug_system.pk) url = reverse('caserun-detail-pane', args=[self.case_run_1.case.pk]) response = self.client.get( url, { 'case_run_id': self.case_run_1.pk, 'case_text_version': self.case_run_1.case.latest_text_version() }) self.assertEqual(HTTPStatus.OK, response.status_code) self.assertContains(response, bug_1.get_full_url()) self.assertContains(response, bug_2.get_full_url())
def test_no_notification_if_assignee_not_set(self, send_mail): BugFactory(assignee=None) self.assertFalse(send_mail.called)