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 for the API #149

Merged

Conversation

josecelano
Copy link
Member

@josecelano josecelano commented Dec 23, 2022

Added some tests to the API before changing the web framework to Axum.

@josecelano josecelano linked an issue Dec 23, 2022 that may be closed by this pull request
@josecelano josecelano force-pushed the issue-142-add-tests-for-the-api branch from eac869b to 460489c Compare December 30, 2022 17:26
@josecelano josecelano marked this pull request as ready for review December 30, 2022 17:43
@josecelano
Copy link
Member Author

hi, @da2ce7 @WarmBeer this is ready to review. These are the tests I've added:

test tracker_api::for_stats_resources::
    should_allow_getting_tracker_statistics ... ok
    should_not_allow_getting_tracker_statistics_for_unauthenticated_users ... ok
test tracker_api::for_torrent_resources::
    should_allow_getting_a_torrent_info ... ok
    should_allow_getting_torrents ... ok
    should_allow_limiting_the_torrents_in_the_result ... ok
    should_allow_the_torrents_result_pagination ... ok
    should_not_allow_getting_a_torrent_info_for_unauthenticated_users ... ok
    should_not_allow_getting_torrents_for_unauthenticated_users ... ok
test tracker_api::for_whitelisted_torrent_resources::
    should_allow_reload_the_whitelist_from_the_database ... ok
    should_allow_removing_a_torrent_from_the_whitelist ... ok
    should_allow_whitelisting_a_torrent ... ok
    should_allow_whitelisting_a_torrent_that_has_been_already_whitelisted ... ok
    should_not_allow_removing_a_torrent_from_the_whitelist_for_unauthenticated_users ... ok
    should_not_allow_whitelisting_a_torrent_for_unauthenticated_users ... ok
test tracker_api::for_key_resources::
    should_allow_deleting_an_auth_key ... ok
    should_allow_generating_a_new_auth_key ... ok
    should_allow_reloading_keys ... ok
    should_not_allow_deleting_an_auth_key_for_unauthenticated_users ... ok
    should_not_allow_generating_a_new_auth_key_for_unauthenticated_users ... ok
    should_not_allow_reloading_keys_for_unauthenticated_users ... ok 

@josecelano josecelano added the Quality & Assurance Relates to QA, Testing, and CI label Dec 30, 2022
@josecelano josecelano force-pushed the issue-142-add-tests-for-the-api branch from 460489c to 11259e8 Compare December 30, 2022 18:03
@josecelano
Copy link
Member Author

ACK 11259e8

@josecelano
Copy link
Member Author

@WarmBeer why do you need to expose the reload whitelist (GET /api/whitelist/reload) and keys (GET /api/keys/reload) "commands" in the API?

@mickvandijke
Copy link
Member

@WarmBeer why do you need to expose the reload whitelist (GET /api/whitelist/reload) and keys (GET /api/keys/reload) "commands" in the API?

@josecelano ,

These commands are for reloading the states from the database. This is useful when an administrator wants to update the tracker whitelist using the database for example.

@josecelano josecelano merged commit d79f58b into torrust:develop Jan 2, 2023
@josecelano josecelano deleted the issue-142-add-tests-for-the-api branch January 2, 2023 09:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Quality & Assurance Relates to QA, Testing, and CI
Projects
Archived in project
Development

Successfully merging this pull request may close these issues.

API overhaul: add tests for the API
2 participants