test: add tests to MailingListSelection functions#154
Merged
lorenzoberts merged 2 commits intokworkflow:unstablefrom Sep 20, 2025
Merged
Conversation
…ListSelection This commit refactors the way we store lore_api_client inside MailingListSelection struct. The objective of this change is to make MailingListSelection functions testable. By using BlockingLoreAPIClient directly in the struct it wasn't possible to instantiate a new MailingListSelection for tests. There is also a minor refactor within process_possible_mailing_lists to replace a for loop with a more idiomatic iter + filter. Signed-off-by: Lorenzo Bertin Salvador <lorenzobs@usp.br>
This commit creates test for almost all MailingListSelection functions. The only one that coudn't be tested is refresh_available_mailing_lists because even when mocking AvailableListsRequest trait it still provokes side effects that are beyond the test scope. Signed-off-by: Lorenzo Bertin Salvador <lorenzobs@usp.br>
133af11 to
bb5e39b
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The main objective of this PR is to add tests for
MailingListSelectionutilitary functions. The idea came from a small refactor inprocess_possible_mailing_listswhich couldn't be validated because there were no tests for this function.The functions probably had no tests because we couldn't instantiate a test
MailingListSelection, due to the way we stored the lore api client in the struct, which didn't allow mocking.When refactoring it to use a
Box<dyn AvailableListsRequest>instead of aBlockingLoreAPIClient, the tests could be created properly.