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

Improvements to tool test error handling. #19009

Draft
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

jmchilton
Copy link
Member

  • Add integration test for invalid admin key.
  • Add tool test to ensure error message is valid JSON.
  • Swap order of require_admin and expose_api - expose_api sets environment so require_admin knows it should return JSON and not HTML. This is the bug fix.

How to test the changes?

(Select all options that apply)

License

  • I agree to license these and all my past contributions to the core galaxy codebase under the MIT license.

try:
result = response.json()
except Exception as e:
raise Exception(
Copy link
Member

Choose a reason for hiding this comment

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

Can you dump the status code and response.text ? I would prefer this over a guess

Copy link
Member Author

Choose a reason for hiding this comment

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

The only time we know this will happen is Galaxies without this patch - so there will be a huge dump of HTML. I think we keep the guess but also I'll dump that huge page I guess.

Copy link
Member

Choose a reason for hiding this comment

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

True, and even our expected error messages are json dumps. Maybe move the response.json to below the statsu code check on the next line ? Then I'm fine with not dumping in the text.

- Add integration test for invalid admin key.
- Add tool test to ensure error message is valid JSON.
- Swap order of require_admin and expose_api - expose_api sets environment so require_admin knows it should return JSON and not HTML. This is the bug fix.
exc = None
try:
data_path = self.galaxy_interactor.test_data_path("cat1", "1.bed")
print(data_path)
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
print(data_path)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants