@pytest.mark.parametrize('start_date, end_date, format_count, total_file_count, total_file_size', [(None, None, 2, 3, TOTAL_FILE_SIZE), (DATE_BEFORE_AIP_1, None, 2, 3, TOTAL_FILE_SIZE), (AIP_1_CREATION_DATE, None, 2, 3, TOTAL_FILE_SIZE), (DATE_AFTER_AIP_1, None, 2, 2, JPEG_1_02_FILE_SIZE), (None, DATE_BEFORE_AIP_2, 1, 1, JPEG_1_01_FILE_SIZE), (None, AIP_2_CREATION_DATE, 2, 3, TOTAL_FILE_SIZE), (None, DATE_AFTER_AIP_2, 2, 3, TOTAL_FILE_SIZE), ('2019-01-01', '2019-01-02', 0, 0, 0), (True, 'NOT A DATE', 2, 3, TOTAL_FILE_SIZE)])
def test_formats_count_contents(app_with_populated_format_versions, start_date, end_date, format_count, total_file_count, total_file_size):
    'Test that content of response matches expectations.\n\n    This integration test uses a pre-populated fixture to verify that\n    the database access layer of our endpoint returns what we expect.\n    '
    results = report_data.formats_count(storage_service_id=1, start_date=parse_datetime_bound(start_date), end_date=parse_datetime_bound(end_date, upper=True))
    formats = results[fields.FIELD_FORMATS]
    assert (len(formats) == format_count)
    assert (sum((format_.get(fields.FIELD_COUNT, 0) for format_ in formats)) == total_file_count)
    assert (sum((format_.get(fields.FIELD_SIZE, 0) for format_ in formats)) == total_file_size)
Test that content of response matches expectations.

This integration test uses a pre-populated fixture to verify that
the database access layer of our endpoint returns what we expect.
@pytest.mark.parametrize('start_date, end_date, format_count, total_file_count, total_file_size', [(None, None, 2, 3, TOTAL_FILE_SIZE), (DATE_BEFORE_AIP_1, None, 2, 3, TOTAL_FILE_SIZE), (AIP_1_CREATION_DATE, None, 2, 3, TOTAL_FILE_SIZE), (DATE_AFTER_AIP_1, None, 2, 2, JPEG_1_02_FILE_SIZE), (None, DATE_BEFORE_AIP_2, 1, 1, JPEG_1_01_FILE_SIZE), (None, AIP_2_CREATION_DATE, 2, 3, TOTAL_FILE_SIZE), (None, DATE_AFTER_AIP_2, 2, 3, TOTAL_FILE_SIZE), ('2019-01-01', '2019-01-02', 0, 0, 0), (True, 'NOT A DATE', 2, 3, TOTAL_FILE_SIZE)])
def test_formats_count_contents(app_with_populated_format_versions, start_date, end_date, format_count, total_file_count, total_file_size):
    'Test that content of response matches expectations.\n\n    This integration test uses a pre-populated fixture to verify that\n    the database access layer of our endpoint returns what we expect.\n    '
    results = report_data.formats_count(storage_service_id=1, start_date=parse_datetime_bound(start_date), end_date=parse_datetime_bound(end_date, upper=True))
    formats = results[fields.FIELD_FORMATS]
    assert (len(formats) == format_count)
    assert (sum((format_.get(fields.FIELD_COUNT, 0) for format_ in formats)) == total_file_count)
    assert (sum((format_.get(fields.FIELD_SIZE, 0) for format_ in formats)) == total_file_size)