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)
def test_10_ingest_upload_broke(self): # no account upload = models.BulkUpload() upload.upload("none", "mybulkreapp.csv") upload.set_id("valid") with self.assertRaises(reapplication.CsvIngestException): reapplication.ingest_from_upload(upload) # structural problem upload = models.BulkUpload() upload.upload("Owner", "mybulkreapp.csv") upload.set_id("wrong_questions") reapplication.ingest_from_upload(upload) assert upload.status == "failed" assert upload.error is not None # content problem upload = models.BulkUpload() upload.upload("Owner", "mybulkreapp.csv") upload.set_id("invalid") reapplication.ingest_from_upload(upload) assert upload.status == "failed" assert upload.error is not None
def test_09_ingest_upload_success(self): upload = models.BulkUpload() upload.upload("Owner", "mybulkreapp.csv") upload.set_id("valid") reapplication.ingest_from_upload(upload)