How to Solve NameError: name 'MagicMock' is not defined -- unittest

Solution: Import the 'MagicMock' module

# Add the following line to the top of your code
from unittest.mock import MagicMock

 

For more information:
unittest MagicMock