Skip to content

test: add tests to MailingListSelection functions#154

Merged
lorenzoberts merged 2 commits intokworkflow:unstablefrom
lorenzoberts:lorenzo/refactor-mailing-list-section-struct
Sep 20, 2025
Merged

test: add tests to MailingListSelection functions#154
lorenzoberts merged 2 commits intokworkflow:unstablefrom
lorenzoberts:lorenzo/refactor-mailing-list-section-struct

Conversation

@lorenzoberts
Copy link
Collaborator

The main objective of this PR is to add tests for MailingListSelection utilitary functions. The idea came from a small refactor in process_possible_mailing_lists which 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 a BlockingLoreAPIClient, the tests could be created properly.

…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>
@lorenzoberts lorenzoberts force-pushed the lorenzo/refactor-mailing-list-section-struct branch from 133af11 to bb5e39b Compare September 20, 2025 14:07
@lorenzoberts lorenzoberts merged commit bb5e39b into kworkflow:unstable Sep 20, 2025
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant