diff --git a/backend/benefit/applications/tests/conftest.py b/backend/benefit/applications/tests/conftest.py index 92a116e01f..6ba2a8267c 100755 --- a/backend/benefit/applications/tests/conftest.py +++ b/backend/benefit/applications/tests/conftest.py @@ -181,7 +181,7 @@ def applications_csv_service_with_one_application(applications_csv_service): @pytest.fixture -def pruned_applications_csv_service(): +def talpa_applications_csv_service(): # retrieve the objects through the default manager so that annotations are added application1 = DecidedApplicationFactory(application_number=100001) application2 = DecidedApplicationFactory(application_number=100002) @@ -194,8 +194,7 @@ def pruned_applications_csv_service(): @pytest.fixture -def pruned_applications_csv_service_with_one_application( - applications_csv_service, application_batch +def talpa_applications_csv_service_with_one_application(application_batch ): application1 = application_batch.applications.all().first() diff --git a/backend/benefit/applications/tests/test_applications_report.py b/backend/benefit/applications/tests/test_applications_report.py index 4fce68ed25..e6a8440f70 100644 --- a/backend/benefit/applications/tests/test_applications_report.py +++ b/backend/benefit/applications/tests/test_applications_report.py @@ -603,14 +603,14 @@ def test_write_application_alterations_csv_file( (True,), ], ) -def test_pruned_applications_csv_output( - pruned_applications_csv_service_with_one_application, instalments_enabled, settings +def test_talpa_applications_csv_output( + talpa_applications_csv_service_with_one_application, instalments_enabled, settings ): settings.PAYMENT_INSTALMENTS_ENABLED = instalments_enabled instalment_amount = decimal.Decimal("123.45") application = ( - pruned_applications_csv_service_with_one_application.get_applications()[0] + talpa_applications_csv_service_with_one_application.get_applications()[0] ) if instalments_enabled: application.calculation.instalments.all().delete() @@ -624,7 +624,7 @@ def test_pruned_applications_csv_output( ) csv_lines = split_lines_at_semicolon( - pruned_applications_csv_service_with_one_application.get_csv_string() + talpa_applications_csv_service_with_one_application.get_csv_string() ) # Assert that there are 18 column headers in the pruned CSV assert len(csv_lines[0]) == 18 diff --git a/backend/benefit/applications/tests/test_talpa_integration.py b/backend/benefit/applications/tests/test_talpa_integration.py index 83c05d7d00..6dc836a4b0 100644 --- a/backend/benefit/applications/tests/test_talpa_integration.py +++ b/backend/benefit/applications/tests/test_talpa_integration.py @@ -36,25 +36,25 @@ def test_talpa_lines(applications_csv_service): ) -def test_talpa_csv_cell_list_lines_generator(pruned_applications_csv_service): +def test_talpa_csv_cell_list_lines_generator(talpa_applications_csv_service): check_csv_cell_list_lines_generator( - pruned_applications_csv_service, expected_row_count_with_header=3 + talpa_applications_csv_service, expected_row_count_with_header=3 ) -def test_talpa_csv_string_lines_generator(pruned_applications_csv_service): +def test_talpa_csv_string_lines_generator(talpa_applications_csv_service): check_csv_string_lines_generator( - pruned_applications_csv_service, expected_row_count_with_header=3 + talpa_applications_csv_service, expected_row_count_with_header=3 ) -def test_talpa_csv_output(pruned_applications_csv_service_with_one_application): +def test_talpa_csv_output(talpa_applications_csv_service_with_one_application): csv_lines = split_lines_at_semicolon( - pruned_applications_csv_service_with_one_application.get_csv_string() + talpa_applications_csv_service_with_one_application.get_csv_string() ) # BOM at the beginning of the file assert csv_lines[0][0] == '\ufeff"Hakemusnumero"' - csv_columns = iter(pruned_applications_csv_service_with_one_application.CSV_COLUMNS) + csv_columns = iter(talpa_applications_csv_service_with_one_application.CSV_COLUMNS) next(csv_columns, None) # Skip the first element for idx, col in enumerate(csv_columns, start=1): @@ -62,33 +62,33 @@ def test_talpa_csv_output(pruned_applications_csv_service_with_one_application): assert ( int(csv_lines[1][0]) - == pruned_applications_csv_service_with_one_application.applications.first().application_number + == talpa_applications_csv_service_with_one_application.applications.first().application_number ) def test_talpa_csv_non_ascii_characters( - pruned_applications_csv_service_with_one_application, + talpa_applications_csv_service_with_one_application, ): application = ( - pruned_applications_csv_service_with_one_application.applications.first() + talpa_applications_csv_service_with_one_application.applications.first() ) application.company_name = "test äöÄÖtest" application.save() csv_lines = split_lines_at_semicolon( - pruned_applications_csv_service_with_one_application.get_csv_string() + talpa_applications_csv_service_with_one_application.get_csv_string() ) assert csv_lines[1][3] == '"test äöÄÖtest"' # string is quoted -def test_talpa_csv_delimiter(pruned_applications_csv_service_with_one_application): +def test_talpa_csv_delimiter(talpa_applications_csv_service_with_one_application): application = ( - pruned_applications_csv_service_with_one_application.applications.first() + talpa_applications_csv_service_with_one_application.applications.first() ) application.company_name = "test;12" application.save() assert ( ';"test;12";' - in pruned_applications_csv_service_with_one_application.get_csv_string() + in talpa_applications_csv_service_with_one_application.get_csv_string() ) @@ -100,13 +100,13 @@ def test_talpa_csv_delimiter(pruned_applications_csv_service_with_one_applicatio ], ) def test_talpa_csv_decimal( - pruned_applications_csv_service_with_one_application, + talpa_applications_csv_service_with_one_application, settings, instalments_enabled, ): settings.PAYMENT_INSTALMENTS_ENABLED = instalments_enabled application = ( - pruned_applications_csv_service_with_one_application.applications.first() + talpa_applications_csv_service_with_one_application.applications.first() ) if instalments_enabled: application.calculation.instalments.all().delete() @@ -123,34 +123,34 @@ def test_talpa_csv_decimal( application.calculation.save() csv_lines = split_lines_at_semicolon( - pruned_applications_csv_service_with_one_application.get_csv_string() + talpa_applications_csv_service_with_one_application.get_csv_string() ) assert csv_lines[1][8] == "123.45" -def test_talpa_csv_date(pruned_applications_csv_service_with_one_application): +def test_talpa_csv_date(talpa_applications_csv_service_with_one_application): application = ( - pruned_applications_csv_service_with_one_application.get_applications().first() + talpa_applications_csv_service_with_one_application.get_applications().first() ) now = datetime.now(timezone.utc) application.batch.decision_date = now application.batch.save() csv_lines = split_lines_at_semicolon( - pruned_applications_csv_service_with_one_application.get_csv_string() + talpa_applications_csv_service_with_one_application.get_csv_string() ) assert csv_lines[1][12] == f'"{now.strftime("%Y-%m-%d")}"' def test_write_talpa_csv_file( - pruned_applications_csv_service_with_one_application, tmp_path + talpa_applications_csv_service_with_one_application, tmp_path ): application = ( - pruned_applications_csv_service_with_one_application.applications.first() + talpa_applications_csv_service_with_one_application.applications.first() ) application.company_name = "test äöÄÖtest" application.save() output_file = tmp_path / "output.csv" - pruned_applications_csv_service_with_one_application.write_csv_file(output_file) + talpa_applications_csv_service_with_one_application.write_csv_file(output_file) with open(output_file, encoding="utf-8-sig") as f: contents = f.read() assert contents.startswith('"Hakemusnumero";"Työnantajan tyyppi"')