-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Manage empty searches in transfer_complete_datasets
#204
Conversation
Raised when searching for a dataset returns nothing
dkist/net/helpers.py
Outdated
try: | ||
datasets = _get_dataset_inventory(datasets)[0] | ||
except IndexError as e: | ||
raise IndexError(f"No results available for dataset {datasets}") from e |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If we do this inside _get_dataset_inventory
we could avoid the try
block which is always my slight preference?
@@ -44,6 +44,17 @@ def test_download_default_keywords(orchestrate_transfer_mock, keywords): | |||
) | |||
|
|||
|
|||
def test_transfer_unavailable_data(mocker): | |||
get_inv_mock = mocker.patch( | |||
"dkist.net.client.DKISTClient.search", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this mocker actually being hit? I would have thought this should be
"dkist.net.client.DKISTClient.search", | |
"dkist.net.helpers.DKISTClient.search", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If it wasn't, surely the test would hit the "An attempt was made to connect to the internet" error (which is what happens if I take the mocker out entirely).
Also it looks like several of the tests are fouling on a |
Codecov Report
@@ Coverage Diff @@
## main #204 +/- ##
=======================================
Coverage 96.41% 96.41%
=======================================
Files 29 29
Lines 1506 1506
=======================================
Hits 1452 1452
Misses 54 54
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. |
Closes #194
In
transfer_complete_datasets
, if_get_dataset_inventory
returns no results (which it might if the ID string is invalid or if the data just aren't available), this catches the error and raises it with an appropriate message.