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

Add arguments for API query parameters when fetching all Dandisets; support creating embargoed Dandisets #1414

Merged
merged 3 commits into from
Feb 29, 2024

Conversation

jwodder
Copy link
Member

@jwodder jwodder commented Feb 28, 2024

Closes #1413.

@jwodder jwodder added minor Increment the minor version when merged Python API labels Feb 28, 2024
Copy link

codecov bot commented Feb 28, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 88.61%. Comparing base (5970a3b) to head (1ed5a55).
Report is 2 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1414      +/-   ##
==========================================
+ Coverage   88.58%   88.61%   +0.02%     
==========================================
  Files          77       77              
  Lines       10499    10527      +28     
==========================================
+ Hits         9301     9328      +27     
- Misses       1198     1199       +1     
Flag Coverage Δ
unittests 88.61% <100.00%> (+0.02%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link
Member

@yarikoptic yarikoptic left a comment

Choose a reason for hiding this comment

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

Let's add a test or two.

ATM we do not really test/deal much with embargoed dandisets seems to me, primarily since we do not even expose embargo option:

dandi/dandiapi.py:    def create_dandiset(self, name: str, metadata: dict[str, Any]) -> RemoteDandiset:

So let's as part of this PR expose that option, create also embargoed dandiset and test listing here for a set of query parameters to see that they map correctly to the API call (as you mentioned -- requests would simply ignore if we do not change them from None)

@jwodder
Copy link
Member Author

jwodder commented Feb 29, 2024

@yarikoptic

test listing here for a set of query parameters to see that they map correctly to the API call

What exactly should be tested? Should there just be a test for each bool argument that checks that a matching Dandiset is/isn't returned when the argument is true/false?

Note that there can't be a test that checks the entirety of the get_dandisets() return value, as the test Dandisets created for most tests persist in later tests, and it's possible for tests to be skipped or run out of order, so there's no guarantee about what Dandisets will exist in the test Archive when a test runs.

@jwodder jwodder marked this pull request as draft February 29, 2024 18:35
@jwodder jwodder changed the title Add arguments for API query parameters when fetching all Dandisets Add arguments for API query parameters when fetching all Dandisets; support creating embargoed Dandisets Feb 29, 2024
@yarikoptic
Copy link
Member

Note that there can't be a test that checks the entirety of the get_dandisets() return value, as the test Dandisets created for most tests persist in later tests, and it's possible for tests to be skipped or run out of order, so there's no guarantee about what Dandisets will exist in the test Archive when a test runs.

I didn't realize that -- I thought that we just have a fixture to populate a number of dandisets and then test on them.

What exactly should be tested? Should there just be a test for each bool argument that checks that a matching Dandiset is/isn't returned when the argument is true/false?

I think testing for that would suffice. Fixture could ensure to populate at least one dandiset to satisfy each criteria, then (with the light of above) - we could test that there is at least one dandiset satisfying the desired criteria.

@jwodder jwodder marked this pull request as ready for review February 29, 2024 19:35
@yarikoptic
Copy link
Member

Thank you!

@yarikoptic yarikoptic merged commit 2cafb50 into master Feb 29, 2024
28 checks passed
@yarikoptic yarikoptic deleted the gh-1413 branch February 29, 2024 20:45
Copy link

🚀 PR was released in 0.61.0 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
minor Increment the minor version when merged Python API released
Projects
None yet
Development

Successfully merging this pull request may close these issues.

get_dandisets: Expose options (embargoed, empty, draft) of the /dandisets/ endpoint
2 participants