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

Add tests #280

Merged
merged 11 commits into from
Jun 12, 2020
Merged

Add tests #280

merged 11 commits into from
Jun 12, 2020

Conversation

HebaruSan
Copy link
Contributor

@HebaruSan HebaruSan commented Jun 10, 2020

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 response
  • test_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

@HebaruSan

This comment has been minimized.

@HebaruSan HebaruSan merged commit 5a5ad24 into alpha Jun 12, 2020
@HebaruSan HebaruSan deleted the feature/tests branch June 12, 2020 23:56
@HebaruSan HebaruSan mentioned this pull request Jun 13, 2020
@HebaruSan HebaruSan mentioned this pull request Jun 20, 2020
@HebaruSan HebaruSan mentioned this pull request Jun 28, 2020
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.

2 participants