unit testing - Method mocked assigns value to a variable -


new mock here. have script like:

def method_being_tested():     self.foo = otherclass()     self.foo.method_trouble()     if "hub" in self.foo.names:         execute instructions here  

now problem in test suite have patched method_trouble of otherclass. variable "names" assigned meaningful value when method_troubled called. since not calling method_trouble, patching instructions inside if never executed. there workaround this?


Comments