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.
Motivation
Tests are a popular way to exercise code and ensure that certain things don't break. Currently SpaceDock has none.
Changes
Now some
pytest
tests are added along with a GitHub workflow to run them. If any new code breaks these things in the future, GitHub will tell us about it.This PR exercises all the
/api/
routes that do not require authentication. Authentication-based routes can be done in future pull requests.test_version
- Retrieves the/version
route and performs simple sanity checks on its responsetest_api_browse
- Retrieves several routes for an empty db and confirms that they returns the expected JSON/api/browse
/api/browse/new
/api/browse/top
/api/browse/featured
test_api_mod
- Creates a simple mod in the db, then requests several API calls and confirms that they return JSON with the correct properties/api/publishers
/api/games
/api/kspversions
/api/1/versions
/api/mod/1
/api/mod/1/latest
/api/user/TestModAuthor
/api/typeahead/mod?query=Test
/api/search/mod?query=Test&page=1
/api/search/user?query=Test&page=0