Skip to content

Conversation

@sirosen
Copy link
Member

@sirosen sirosen commented Jan 11, 2025

This command has not had any functional test coverage, so these are the first tests for the command.

  • Add an initial test for 'endpoint search'
  • Add a test for --filter-entity-type

--filter-entity-type was added in #1055, but it was not possible to test it at the time because we had no fixture data to work off of.
To build initial data, I grabbed a live service search result and rewrote it thoroughly to remove my account and collection details.

@pjhinton-globus, the second commit here shows what I wanted you to be able to add.
When I realized that we'd need to setup new fixture data for endpoint search, I felt it was unfair to ask for this as part of an incremental addition to an existing, untested command.

I haven't discussed my decision to use str.split() to build out the data with anyone yet, which is probably the most contentious thing I've done here.

This adds the necessary mocking framework pieces to have a simulated
endpoint search response, and a test against that response.
For simplicity, just check that the value passed appears in the full
URL.
@sirosen sirosen added the no-news-is-good-news This change does not require a news file label Jan 11, 2025
Comment on lines +115 to +119
"GCP_mapped_collection",
"GCP_guest_collection",
"GCSv5_endpoint",
"GCSv5_mapped_collection",
"GCSv5_guest_collection",
Copy link
Member

Choose a reason for hiding this comment

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

Do these values appear in an enum somewhere? If so, it will be worthwhile to use that enum directly (or perhaps to compose this list and then make assertions that it matches the enum).

Copy link
Member Author

Choose a reason for hiding this comment

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

They do not appear in an enum (IMO, "thank goodness", str enums are so clunky...).

They're in a Literal type annotation.
Would you like me to write the "magic" to extract them from that annotation? I've done it before and it's pretty easy, but it adds a little bit of complexity to the test module.

- explode space split strings into sets and sanity check
- refine internal helper params and fixture metadata
- make test criteria for table output clearer
- parse the query string for testing
- also, test name normalization of the filter_entity_type param
@sirosen sirosen merged commit 93bab5c into globus:main Jan 13, 2025
6 checks passed
@sirosen sirosen deleted the add-epsearch-tests branch January 13, 2025 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

no-news-is-good-news This change does not require a news file

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants