thermondo Developer Handbook
In general:
Rule of thought:
It is not necessary to test framework features or features of other third-part libraries. But if you glue together some code of libraries, this should be tested.
Mock should be only used as an exception. Most times, you can prevent it by using configuration, dependency injection or good code design.
(example: the whole Django test-suite does not use mock at all)
If you can, prefer the pytest monkeypatch
to the mock-library.
Don’t do mock-like tests that check method-calls of mocked objects. This is a sign of bad design. You should test actions and check the desired results. Even when this means creating a file locally or saving things to the database.
The unit tests don’t replace a manual test of the feature!