How to Solve NameError: name 'mock' is not defined

Solution: Import the 'mock' module

# Add the following line to the top of your code
import mock

 

For more information:
Python mock