Skip to content

Conversation

@josecelano
Copy link
Member

@josecelano josecelano commented May 9, 2023

These refactorings will allow writing tests that require a mock for the TrackerService.

  • Extract tracker API client. This will isolate the API calls in one struct.
  • Extract tracker statistics importer

josecelano added 3 commits May 9, 2023 13:03
The test for listing torrents was failing becuase the uploaded torrents
was not in the result. Since we added a pagination limit in this PR:

#142

Now it can happen that the torrent you've just uploaded is not in the
response, because tests run in paralell.

When we will able to run this test mocking the `TrackerService` we
couuld run it with an isolated environment, so the expected result if
always only one torrent. Then we could check that the torrent is on the
list again.
@josecelano josecelano added the Code Cleanup / Refactoring Tidying and Making Neat label May 9, 2023
@josecelano josecelano requested a review from mickvandijke May 9, 2023 12:36
@josecelano josecelano changed the title Refactor TrackerService Refactor TrackerService to improve app testability May 9, 2023
josecelano added 3 commits May 9, 2023 13:45
Instead of using the API client directly. TrackerService is easier to
mock becuase you only need to build simple app structs instead of
reqwest responses.
@josecelano josecelano marked this pull request as ready for review May 9, 2023 15:36
@josecelano
Copy link
Member Author

ACK 404caee

@josecelano josecelano requested a review from da2ce7 May 9, 2023 16:12
@josecelano josecelano merged commit f1270ff into torrust:develop May 10, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Code Cleanup / Refactoring Tidying and Making Neat

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant