Mocks and Patches
Learn about mocks and patches and when to use them.
We'll cover the following...
Overview
Mocking and patching are techniques used to isolate certain parts of a system under test and control their behavior. They are useful because they allow us to test the behavior of our code under different scenarios and verify that it behaves correctly in those scenarios.
Mocking involves creating a fake or mock version of an object or module used in our system under test. This mock object is designed to mimic the behavior of the real object, but it can be controlled by the test to return specific values or to raise exceptions.
...