Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
fixes #523
Overview
This just adds a single get_email call to the
GardenClient.__init__
method, which ensures that the client has authed with our backend at least once before attempting to pull a garden or entrypoint to run on the demo endpoint.This makes it so you can't accidentally try running an entrypoint before the backend has had the chance to add you to the Garden Users globus group.
Discussion
This is definitely a bit of a hack, but so is the backend's automatically adding users to the group. If there's an obvious cleaner way to do this I'm open to it, this was just the first easy fix to come to mind.
Testing
I had to tweak the garden_client fixture so the call to
BackendClient.get_user_info
would be mocked with test user data. This fixed almost all of the tests except for one backend client test, since thebackend_client
fixture depends on thegarden_client
fixture (which now mocks the backend client method being tested).I'll defer to the judgement of the test czar @hholb, but I decided it was ok to delete the single remaining affected test. It seemed like the logic it was testing of "an exception is raised by the backend" is something that could be (and already is, afaik) covered by the backend's unit tests, but I'm open to pushback on this!
Another more robust / time consuming option would be to make the
backend_client
fixture independent of thegarden_client
fixture, I just didn't think it was worth the effort for this PR📚 Documentation preview 📚: https://garden-ai--524.org.readthedocs.build/en/524/