Пример #1
0
    def test_11_generate_error_report(self):
        account = models.Account(**{"id" : "Owner"})

        # provide our own callback to check the report generation
        def callback(report):
            assert report is not None
            assert "1234-5678" in report
            assert "C13" in report

        with self.assertRaises(reapplication.ContentValidationException):
            reapplication.ingest_csv("invalid.csv", account, callback)

        # this will use the default callback, which will try to send me an email
        upload = models.BulkUpload()
        upload.upload("Owner", "mybulkreapp.csv")
        upload.set_id("invalid")
        upload.save()
        reapplication.ingest_from_upload(upload)
Пример #2
0
    def test_08_ingest_csv_success(self):
        account = models.Account(**{"id" : "Owner"})
        try:
            result = reapplication.ingest_csv("valid.csv", account)
            assert result["reapplied"] == 3
            assert result["skipped"] == 0
        except reapplication.ContentValidationException:
            assert False
        except reapplication.CsvValidationException:
            assert False

        # give the index a chance to catch up
        time.sleep(2)

        # now test that all the reapplications got made
        reapps = models.Suggestion.get_by_owner("Owner")
        assert len(reapps) == 3
        for reapp in reapps:
            assert reapp.application_status == "submitted"
            assert reapp.bibjson().title in ["First Title", "Second Title", "Third Title"]