diff --git a/daily_read/order_portal.py b/daily_read/order_portal.py index 1b58224..eba449e 100644 --- a/daily_read/order_portal.py +++ b/daily_read/order_portal.py @@ -161,12 +161,12 @@ def upload_report_to_order_portal(self, report, project, status): # TODO: check Encoded to utf-8 to display special characters properly response = requests.post(url, headers=self.headers, json=indata) + operation = "updated" if report else "hidden" if response.status_code == 200: - operation = "Updated" if report else "Hid" - log.info(f"{operation} report for order with project id: {project.project_id}") + log.info(f"Report {operation} for order with project id: {project.project_id}") return True else: log.error( - f"Report not uploaded for order with project id: {project.project_id}\nReason: {response.status_code} {response.reason}" + f"Report not {operation} for order with project id: {project.project_id}\nReason: {response.status_code} {response.reason}" ) return False diff --git a/tests/test_order_portal.py b/tests/test_order_portal.py index 5a24687..d77b202 100644 --- a/tests/test_order_portal.py +++ b/tests/test_order_portal.py @@ -29,7 +29,7 @@ def test_get_and_process_orders_open_upload_fail(data_repo_full, mock_project_da "test data", modified_orders[orderer]["projects"]["Library QC finished"][0], "published" ) assert not uploaded - assert f"Report not uploaded for order with project id: {order_id}\nReason: 404" in caplog.text + assert f"Report not updated for order with project id: {order_id}\nReason: 404" in caplog.text def test_get_and_process_orders_open_and_upload(data_repo_full, mock_project_data_record, get_env_file_path): @@ -108,7 +108,7 @@ def test_get_and_process_orders_open_with_report_and_upload( mock_post.assert_called_once_with( url, headers={"X-OrderPortal-API-key": config_values.ORDER_PORTAL_API_KEY}, json=indata ) - assert f"Updated report for order with project id: {order_id}" in caplog.text + assert f"Report updated for order with project id: {order_id}" in caplog.text def test_get_and_process_orders_open_to_aborted_with_report_and_upload(