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

Core functionality of /data_objects/study/{study_id} endpoint is not being tested #725

Open
eecavanna opened this issue Oct 9, 2024 · 0 comments
Labels
bug Something isn't working X SMALL Less than 1 day

Comments

@eecavanna
Copy link
Collaborator

The only test that targets the /data_objects/study/{study_id} endpoint, targets a corner case where the specified study does not exist.

def test_find_data_objects_for_nonexistent_study(api_site_client):
r"""
Confirms the endpoint returns an unsuccessful status code when no `Study` having the specified `id` exists.
Reference: https://docs.pytest.org/en/stable/reference/reference.html#pytest.raises
Note: The `api_site_client` fixture's `request` method will raise an exception if the server responds with
an unsuccessful status code.
TODO: Add tests focused on the situation where the `Study` _does_ exist.
"""
ensure_schema_collections_and_alldocs()
with pytest.raises(requests.exceptions.HTTPError):
api_site_client.request(
"GET",
"/data_objects/study/nmdc:sty-11-hdd4bf83",
)

There are no tests that target the core functionality (a.k.a. "happy path") of the endpoint.

# FIXME: Seed the database with documents that would be included in an `alldocs` collection,
# such that the `/data_objects/study/{study_id}` endpoint (which uses that collection)
# would return some data. Currently, we are practically _not testing_ that endpoint.

Previously, there was a test that targeted the core functionality; but it was removed because it relied on a static database dump (which conformed to a specific schema) residing on the NERSC filesystem.

Related (bug report involving this endpoint): #723

@eecavanna eecavanna added bug Something isn't working X SMALL Less than 1 day labels Oct 9, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working X SMALL Less than 1 day
Projects
None yet
Development

No branches or pull requests

1 participant