I have a test that works by mocking out the web service. I have it where it returns a specific return value when a specific method is called. I'm verifying that the wrapped function returns the value I expect. Issue is that the test seems almost useless.
Here is what I have -
@patch('run.Client')
def test(self, mock_client):
service = WebService()
mock_client.return_value.service.GetMemberStatus.return_value = 'E'
member_status = service.get_member_status(11)
self.assertEqual('E', member_status)
What I'm looking to do is only return E if the GetMemberStatus method is called with specific parameters. I've tried to do -
mock_client.return_value.service.GetMemberStatus(11, '', '').return_value = 'E'
however this doesn't seem to change anything.
Question - How can I set a mocked methods return value only if called with appropriate parameters?