I have two classes A and B. I want to test function foo_a of A. Using some business logic, foo_a creates two possible instances of B (with different arguments) and calls function foo_b of B:
class A:
def foo_a(self, *args, **kwargs):
# some code above
if condition_1:
foo_b_result = B(**arguments_1).foo_b()
else:
foo_b_result = B(**arguments_2).foo_b()
# some code below that returns foo_b_result + other objects independent of foo_b_result
The problem comes from the fact that foo_b is a complexe function that calls APIs and other stuff. I don't want to mock APIs here in this unit test so that foo_b returns the appropriate output, indeed, foo_b is already tested elsewhere in my set of unit tests for class B. Thus, in this context I care more about the correctness of arguments_1 and arguments_2 than the correctness of foo_b_result. Therefore, It would be nice if I could mock foo_b so that it returns outputs that could easily show if foo_b has been called with the right instance of B. For instance, foo_b could return arguments_1 or arguments_2.
Maybe there is another better approach for unit testing foo_a in this case, any idea is welcome.
UPDATE: Another way would be to create a new function that takes as input condition_1 and returns either arguments_1 or arguments_2 (this function could be tested easily). Then I would mock foo_b so that it always return the same value (for instance 0). But still, it would be interesting to know if it's possible to mock foo_b so that it returns values according to arguments_1 or arguments_2.