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

Rewrite library module tests to use mocked inputs #169

Merged
merged 2 commits into from
May 23, 2024
Merged

Conversation

tianyizheng02
Copy link
Contributor

@tianyizheng02 tianyizheng02 commented May 23, 2024

Contributes to #166

Rewrite tests/library_test.py to use mocked HTTP requests instead of calling module functions directly and making real HTTP requests (see #166). I deleted the tests for the library bookmark functions, since the code makes it clear that the new library API doesn't support bookmarks anyway. I ran pytest locally, and there appear to be no more errors with the library tests.

I also fixed a heretofore unnoticed bug in the library URL, where the URL accidentally contains newline characters due to a triple-quoted string being used instead of a single- or double-quoted string.

Rewrite tests/library_test.py to use mocked HTTP requests instead of
calling module functions directly and making real HTTP requests (see
issue #166). The mocked JSON response is stored in the newly added file
tests/samples/library_mock_response_water.json.

This commit also fixes a heretofore unnoticed bug in the library URL,
where the URL accidentally contains newline characters due to a
triple-quoted string being used instead of a single- or double-quoted
string.
Reenable tests/library_tests.py for automated testing with pytest in
GitHub workflows. These tests were temporarily disabled in PR #167
because they did not use mocked inputs (see issue #166).
@tianyizheng02
Copy link
Contributor Author

All tests pass even after I reenabled the library module tests for GitHub.

@tianyizheng02 tianyizheng02 requested a review from nij-patel May 23, 2024 02:12
@nij-patel nij-patel merged commit 3a165b2 into dev May 23, 2024
1 check passed
@nij-patel nij-patel deleted the mock-library-tests branch May 23, 2024 04:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants