I have a method that calls two other methods in it.
def main_method(self, query):
result = self.method_one(query)
count = self.method_two(result)
return count
def method_one(self, query):
#Do some stuff based on results.
#This method hits the database.
return result
def method_two(self, result):
#Do some stuff based on result.
#This method also hits the database.
return count
I'm not very experienced at unit testing and have never worked with Mocks and Stubs.
I'm not too sure how to create a unit test for my first method. Since method_one and method_two hit the database many times and they are very expensive, I have decided to use mox to create a mock or stub in order to eliminate the need of hitting database.
I would really appreciate it if someone who has experience working with Mocks and Stubs give me some hints on using mocks and stubs for my case.