-
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.
Merge pull request #31 from aanil/fix_git
Deal with aborted orders which were once in processing, also add codecov to see if it works
- Loading branch information
Showing
7 changed files
with
132 additions
and
15 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
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
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
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 |
---|---|---|
|
@@ -83,6 +83,40 @@ def test_get_and_process_orders_open_with_report_and_upload(data_repo_full, mock | |
) | ||
|
||
|
||
def test_get_and_process_orders_open_to_aborted_with_report_and_upload(data_repo_full, mock_project_data_record): | ||
"""Test getting, processing an open order with an existing Project progress report and uploading the report to the Order portal""" | ||
orderer = "[email protected]" | ||
order_id = "NGI123461" | ||
config_values = config.Config() | ||
with mock.patch("daily_read.statusdb.StatusDBSession"): | ||
data_master = ngi_data.ProjectDataMaster(config_values) | ||
|
||
data_master.data = {order_id: mock_project_data_record("open_to_aborted_with_report")} | ||
|
||
op = order_portal.OrderPortal(config_values, data_master) | ||
with mock.patch("daily_read.order_portal.OrderPortal._get", side_effect=mocked_requests_get): | ||
op.get_orders(orderer=orderer) | ||
|
||
assert op.all_orders[4]["identifier"] == order_id | ||
modified_orders = op.process_orders(config_values.STATUS_PRIORITY_REV) | ||
|
||
assert modified_orders[orderer]["delete_report_for"]["Library QC finished"][0] == data_master.data[order_id] | ||
with mock.patch("daily_read.order_portal.requests.post") as mock_post: | ||
mock_post.return_value.status_code = 200 | ||
op.upload_report_to_order_portal( | ||
"", modified_orders[orderer]["delete_report_for"]["Library QC finished"][0], "review" | ||
) | ||
url = f"{config_values.ORDER_PORTAL_URL}/api/v1/report/{op.all_orders[4]['reports'][0]['iuid']}" | ||
indata = dict( | ||
order=order_id, | ||
name="Project Progress", | ||
status="review", | ||
) | ||
mock_post.assert_called_once_with( | ||
url, headers={"X-OrderPortal-API-key": config_values.ORDER_PORTAL_API_KEY}, json=indata | ||
) | ||
|
||
|
||
def test_get_and_process_orders_closed(data_repo_full, mock_project_data_record): | ||
"""Test getting and processing an order closed within the timeframe of Project progress report deletion""" | ||
orderer = "[email protected]" | ||
|