Say I have a mock object (let it be Mock or MagicMock). I want to mock one of its method to return one value for a specific input and to return another value for another specific input. How do I do it without having to care about the order the input is sent to the method?
Pseudo code:
def test_blah():
o = MagicMock()
# How to do I these?
o.foo.return_value.on(1) = 10
o.foo.return_value.on(2) = 20
assert o.foo(2) == 20
assert o.foo(1) == 10