Skip to content
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

gdc.py: Show error code of failed download request #20

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

roshnet
Copy link

@roshnet roshnet commented Apr 6, 2019

No description provided.

Copy link
Collaborator

@ayan-b ayan-b left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be awesome if you can add some tests. Let me know if you need any help.

@roshnet
Copy link
Author

roshnet commented Apr 7, 2019

Yeah, I am working on it.
Thanks for the suggestion! 😃

Add "test_download_error()" to print the error code on the console. This will print a failure message along with the error code of the network error that happened.
@roshnet
Copy link
Author

roshnet commented Apr 7, 2019

As of now, the /data endpoint returns a 503 response, as the servers are down for maintenance.
Once the servers are up and running, we can expect a 404 response for the invalid resource the test case tries to access.

@@ -69,6 +69,11 @@ def test_download():
os.unlink(file_path)


def test_download_error():
uuid = "something-invalid-0101"
gdc.download(uuid)
Copy link
Collaborator

@ayan-b ayan-b Apr 7, 2019

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Great start! However, you are not asserting the output to some expected output, so the test is not running. You may take a look at the other tests in the same file for some inspiration. 😃

uuid = "something-invalid-0101"
actual = gdc.download(uuid)
expected = <insert the string here>
assert actual == expected

Also, take a look at the CONTRIBUTING file in #17 .

@@ -88,3 +93,6 @@ def test_get_samples_clinical():
project_id = "TCGA-OV"
actual = gdc.get_samples_clinical(project_id)
assert actual['case_id'][0] == "71faa2c1-0d5b-4dcc-bdf9-f2405f29907c"


test_download_error()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You need not to execute the function. pytest will discover the test and will run by itself.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oops, I forgot to remove that part after testing locally, will remove it.

@ayan-b
Copy link
Collaborator

ayan-b commented Apr 8, 2019

@roshnet need a rebase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants