- Create the database access module. This module will have the ElasticClient class definition. It will also have any additional definitions that this class needs.
- This recipe will use unittest and doctest to create a unified suite of tests. It will use the Mock class from unittest.mock, as well as json. Since this module is separate from the unit under test, it needs to import ch11_r08_load, which has the class definitions that will be tested:
import unittest from unittest.mock import * import doctest import json import ch11_r08_load
- Here's the overall framework for a test case. We'll fill in the setUp() and runTest() methods of this test below. The name shows that we're given an instance of ElasticClient, when we invoke ...