Search the courses, subjects, tracks, games and features, or jump straight to a page.
3 cards from this section. Quick, good the night before a test.
What is the purpose of mocking in software testing?
Think about what external factors could affect a test.
What is the Mock object in Python?
Recall the class from the unittest.mock module.
What is mocking used for in testing?
Think about what isolating tests helps achieve.
True or False: Patching is used to permanently change an object's behavior.
Consider the duration of the object's changed state.
Develop a mock for a database call within an application. Create a test that verifies database interaction using this mock.
Think of how you can use .return_value to simulate responses.
Using patching, write a test that checks if your code correctly handles network errors when calling an API.
Consider using mock_get.side_effect for simulating an exception.
5 more questions in this section. Enroll free to practise them all.
Enroll free