Exemplo n.º 1
0
 def test_recheck_all_open_issues(self):
     """Check that recheck_all_open_issues call changes those issues
     that are not resolved
     And handles invalid issues
     """
     partner = PartnerFactory(short_name='A name')
     issue_resolved = FlaggedIssueFactory(
         content_object=partner,
         issue_id='partners_must_have_short_name',
         issue_status=ISSUE_STATUS_RESOLVED,
     )
     issue_new = FlaggedIssueFactory(
         content_object=partner,
         issue_id='partners_must_have_short_name',
         issue_status=ISSUE_STATUS_NEW,
     )
     issue_bad = FlaggedIssueFactory(
         content_object=partner,
         issue_status=ISSUE_STATUS_NEW,
     )
     checks.recheck_all_open_issues()
     issue_resolved_updated = FlaggedIssue.objects.get(pk=issue_resolved.pk)
     self.assertEqual(issue_resolved_updated.date_updated,
                      issue_resolved.date_updated)
     issue_new_updated = FlaggedIssue.objects.get(pk=issue_new.pk)
     self.assertNotEqual(issue_new_updated.date_updated,
                         issue_new.date_updated)
     issue_bad_updated = FlaggedIssue.objects.get(pk=issue_bad.pk)
     self.assertEqual(issue_bad_updated.date_updated,
                      issue_bad.date_updated)
Exemplo n.º 2
0
    def test_flagged_issue(self):
        partner = PartnerFactory()
        issue = FlaggedIssueFactory(content_object=partner,
                                    issue_id="321",
                                    message='test message')
        self.assertEqual(str(issue), u"test message")

        issue = FlaggedIssueFactory(content_object=partner,
                                    issue_id="321",
                                    message=u"R\xe4dda Barnen")
        self.assertEqual(str(issue), u"R\xe4dda Barnen")
Exemplo n.º 3
0
 def test_get_or_new_returns_saved(self):
     issue_id = 'test-return-saved'
     partner = PartnerFactory()
     issue = FlaggedIssueFactory(content_object=partner,
                                 issue_id=issue_id,
                                 message='test message')
     self.assertTrue(issue.pk is not None)
     issue_back = FlaggedIssue.get_or_new(partner, issue_id)
     # make sure we got the same one back
     self.assertEqual(issue.pk, issue_back.pk)
Exemplo n.º 4
0
 def test_recheck_all_open_issues_task(self):
     UserFactory(username="******")
     amendment = InterventionAmendmentFactory()
     issue = FlaggedIssueFactory(
         content_object=amendment,
         issue_id='interventions_amendments_no_file',
         issue_status=ISSUE_STATUS_NEW,
     )
     tasks.recheck_all_open_issues_task()
     issue_updated = FlaggedIssue.objects.get(pk=issue.pk)
     self.assertEqual(issue_updated.issue_status, ISSUE_STATUS_RESOLVED)