New to Mock here. So I have a script like:
def method_being_tested():
self.foo = OtherClass()
self.foo.method_trouble()
if "Hub" in self.foo.names:
execute some instructions here
Now the problem is that in my test suite I have patched the method_trouble of OtherClass. Now the variable "names" is assigned a meaningful value when method_troubled is called. Since I am not really calling the method_trouble, but patching it so the instructions inside the if are never executed. Is there any workaround for this?
Aucun commentaire:
Enregistrer un commentaire