I am implementing the following class:
class TestInitializeConnection(TestMyDriver)
The super class (TestMyDriver) is a TestCase, meaning:
class TestMyDriver(test.TestCase):
the super class has an attribute named driver that basically is sort of a mock of the tested driver and it declared as follows:
self.driver = mocks.MyDriver()
now In my (TestInitializeConnection) I want to implement the following test:
def test_initialize_connection(self):
self.driver.initialize_connection(self.volume, self.connector)
Somewhere in the code of the function initialize_connection, there is a private method that is being called
specs = self._get_specs(volume)
and I want to make my test to tell this call of _get_specs(volume) to return a specific value, for example a dictionary with the value: {'iops': 100, 'bandwith': 200}
What is the best way of doing so?
Thanks, Matan