def test_dont_save_pdf(fake_pdf, user, settings, mock_transform_ciprs_document): settings.CIPRS_SAVE_PDF = False record = [{"Defendant": {"Name": "Jon Doe"}}] mock_transform_ciprs_document.return_value = record batch = import_ciprs_records([fake_pdf], user) assert not batch.files.exists()
def test_save_pdf__multiple(fake_pdf, fake_pdf2, user, settings, mock_transform_ciprs_document): settings.CIPRS_SAVE_PDF = True record = [{"Defendant": {"Name": "Jon Doe"}}] mock_transform_ciprs_document.return_value = record batch = import_ciprs_records([fake_pdf, fake_pdf2], user) assert batch.files.count() == 2
def test_import_ciprs_records(fake_pdf, user, mock_ciprs_reader): """Test basic import_ciprs_records() without testing full ETL.""" record = {"Defendant": {"Name": "Jon Doe"}} mock_ciprs_reader.return_value = [record] batch = import_ciprs_records([fake_pdf], user) assert Batch.objects.count() == 1 assert batch.label == record["Defendant"]["Name"] assert batch.records.count() == 1