thunderbird / thunderbird/appointment

Mock and test background tests

Open
#486 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement
Dominant language
Python
Stars
552
Forks
29
Avg merge
1d 6h
Merged PRs (30d)
23

Description

Right now we're testing the mailers independently of the functions they're run in.

We should mock the background tasks and inject our mock into with_client. We can then assert that add_task has been called with the correct parameters.
https://docs.python.org/3/library/unittest.mock.html

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by locating the existing mailer tests and the with_client entry point. Read how background tasks are currently invoked, then use the Python unittest.mock guidance to inject a mock and verify that add_task receives the correct parameters. Done means the tests cover these calls without running the background tasks themselves.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
testing-qa
Issue type
Refactor
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.