-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Only hide report if the the order has a report
- Loading branch information
Showing
3 changed files
with
56 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -33,6 +33,14 @@ | |
"internal_proj_status": "Ongoing", | ||
} | ||
|
||
dummy_order_closed_no_report = { | ||
"orderer": "[email protected]", | ||
"project_dates": {}, | ||
"internal_id": "P123462", | ||
"internal_name": "D.Dummysson_23_02", | ||
"internal_proj_status": "Ongoing", | ||
} | ||
|
||
order_portal_resp_order_processing = { | ||
"identifier": "NGI123456", | ||
"title": "Test run with nano", | ||
|
@@ -161,7 +169,19 @@ | |
}, | ||
}, | ||
"status": "closed", | ||
"reports": [], | ||
"reports": [ | ||
{ | ||
"iuid": "c5ee943", | ||
"name": "Project Progress", | ||
"filename": "project_progress.html", | ||
"status": "published", | ||
"modified": "2024-01-15T15:09:18.732Z", | ||
"links": { | ||
"api": {"href": "https://orderportal.example.com/orders/api/v1/report/c5ee943"}, | ||
"file": {"href": "https://orderportal.example.com/orders/report/c5ee943"}, | ||
}, | ||
}, | ||
], | ||
"history": { | ||
"preparation": "2023-07-06", | ||
"submitted": "2023-07-06", | ||
|
@@ -187,6 +207,10 @@ | |
}, | ||
} | ||
|
||
order_portal_resp_order_closed_no_report = copy.deepcopy(order_portal_resp_order_closed) | ||
order_portal_resp_order_closed_no_report["identifier"] = "NGI123462" | ||
order_portal_resp_order_closed_no_report["reports"] = [] | ||
|
||
|
||
def _create_all_files(file_list, data_location): | ||
"""Helper method to create files in file_list inside data_location""" | ||
|
@@ -344,6 +368,16 @@ def _method(status): | |
config_values.STATUS_PRIORITY_REV, | ||
dummy_order_closed["internal_proj_status"], | ||
) | ||
if status == "closed_no_report": | ||
mock_record = ngi_data.ProjectDataRecord( | ||
"NGIS/2023/staged_file2.json", | ||
dummy_order_closed_no_report["orderer"], | ||
dummy_order_closed_no_report["project_dates"], | ||
dummy_order_closed_no_report["internal_id"], | ||
dummy_order_closed_no_report["internal_name"], | ||
config_values.STATUS_PRIORITY_REV, | ||
dummy_order_closed_no_report["internal_proj_status"], | ||
) | ||
if status == "open_with_report": | ||
mock_record = ngi_data.ProjectDataRecord( | ||
"NGIS/2023/NGI123453.json", | ||
|
@@ -389,6 +423,7 @@ def json(self): | |
order_portal_resp_order_processing_mult_reports, | ||
order_portal_resp_order_processing_single_report, | ||
order_portal_resp_order_processing_to_aborted, | ||
order_portal_resp_order_closed_no_report, | ||
] | ||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -164,6 +164,24 @@ def test_get_and_process_orders_closed(data_repo_full, mock_project_data_record, | |
assert modified_orders[orderer]["delete_report_for"]["All Raw Data Delivered"][0] == data_master.data[order_id] | ||
|
||
|
||
def test_get_and_process_orders_closed_no_report(data_repo_full, mock_project_data_record, get_env_file_path): | ||
"""Test getting and processing an order closed within the timeframe of Project progress report deletion""" | ||
orderer = "[email protected]" | ||
order_id = "NGI123462" | ||
config_values = config.Config(get_env_file_path) | ||
with mock.patch("daily_read.statusdb.StatusDBSession"): | ||
data_master = ngi_data.ProjectDataMaster(config_values) | ||
|
||
data_master.data = {order_id: mock_project_data_record("closed_no_report")} | ||
|
||
op = order_portal.OrderPortal(config_values, data_master) | ||
op.get_orders(orderer=orderer) | ||
|
||
assert op.all_orders[5]["identifier"] == order_id | ||
modified_orders = op.process_orders(config_values.STATUS_PRIORITY_REV) | ||
assert not modified_orders[orderer]["delete_report_for"] | ||
|
||
|
||
def test_get_and_process_orders_mult_reports(data_repo_full, mock_project_data_record, get_env_file_path): | ||
"""Test getting and processing orders with multiple Project progress reports""" | ||
orderer = "[email protected]" | ||
|