-
Notifications
You must be signed in to change notification settings - Fork 27
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
Add integration test to download a file by filename #29
Comments
Downloading isn't actually a function of the python client. The best it does is provide a download URL based on the file id, and it's up to the consumer of the API to do with that as they will. With the functionality we have, I think that test would be more of a test of the API itself than the python client. I'm not especially proud of the tests I've put in because they don't do a very good job of distinguishing testing the API vs. the client. Ideally, I think, the tests should cover the internal data structures and consuming the API correctly rather than relying on the test server to behave the way we expect it to. There's no reason we can't also have integration tests against the server, but it would make sense to keep those separate from the internal tests. So in that respect, I think a test downloading the file wouldn't provide any more information about the state of the python client than would testing that the download url is built the way we expect it to be. |
Ah, I see, you provide a download URL for files here: dataverse-client-python/dataverse/file.py Line 12 in f84b980
Very good point about unit vs integration tests. I'll add the word "integration" to the title of this issue. I feel like I'm getting some testing of https://apitest.dataverse.org as a nice byproduct of integration tests. :) |
I was just looking at IQSS/dataverse#2700 and thinking, "Ideally, how would we have people programmatically download a file of interest?"
I think the answer to this question is for the user to supply the following information:
I was just looking at https://github.com/IQSS/dataverse-client-python/blob/d6e2199f21cddffac37d94d4e39caeaece70ee7e/dataverse/test/test_dataverse.py and I found test where "cat.jpg" is deleted by filename but I couldn't find an example of where a file is downloaded by filename. I think this would be a nice test to have, if it isn't too much trouble to add.
Basically, the DOI of the dataset would be the starting point. Then you enumerate the files in the dataset. Then you find the file that matches "cat.jpg" and download it based on its database id (or some sort of persistent identifier for files, if/when this is implemented as part of IQSS/dataverse#2438 ).
The text was updated successfully, but these errors were encountered: