diff --git a/src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py b/src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py index 45b75d28..eac3e19a 100644 --- a/src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py +++ b/src/coldfront_plugin_cloud/management/commands/fetch_daily_billable_usage.py @@ -194,6 +194,7 @@ def load_csv(location) -> DataFrameGroupBy: location, engine="pyarrow", dtype={INVOICE_COLUMN_COST: pandas.ArrowDtype(pyarrow.decimal128(12, 2))}, + quotechar="|", ) return df.groupby(INVOICE_COLUMN_ALLOCATION_ID) diff --git a/src/coldfront_plugin_cloud/tests/unit/test_fetch_daily_billable_usage.py b/src/coldfront_plugin_cloud/tests/unit/test_fetch_daily_billable_usage.py index a52c2174..477801ff 100644 --- a/src/coldfront_plugin_cloud/tests/unit/test_fetch_daily_billable_usage.py +++ b/src/coldfront_plugin_cloud/tests/unit/test_fetch_daily_billable_usage.py @@ -14,11 +14,11 @@ from django.core.management import call_command - +# Quote char `|` should be read correctly by fetch command TEST_INVOICE = """ Project - Allocation ID,SU Type,Cost -test-allocation-1,OpenStack CPU,100.25 -test-allocation-1,OpenStack V100 GPU,500.37 +|test-allocation-1, foo|,OpenStack CPU,100.25 +|test-allocation-1, foo|,OpenStack V100 GPU,500.37 test-allocation-2,OpenStack CPU,0.25 """ @@ -75,7 +75,9 @@ def test_read_csv_and_get_allocation_usage(self, mock_load_service_invoice): invoice = c.load_csv(test_invoice_data) mock_load_service_invoice.return_value = invoice - usage_info = c.get_allocation_usage("Test", "2025-01-11", "test-allocation-1") + usage_info = c.get_allocation_usage( + "Test", "2025-01-11", "test-allocation-1, foo" + ) usage_info_dict = usage_models.to_dict(usage_info) self.assertEqual(usage_info_dict["OpenStack CPU"], "100.25")