Is there any possible way to test code that passes the result of one method to another? I know it's not advisable to test the internal mechanics of a method, but in this case, the only output is a side effect, so I can't assert on the result.
@mock.patch("myclass.client")
def test_stuff(self, mock_client):
TEST_THING = 'foo'
mock_client.get_thing.return_value = TEST_THING
mock_client.get_another_thing.return_value = True
class_under_test.do_something()
mock_client.get_another_thing.assert_called_with(TEST_THING) // Fails, since return value is wrapped in a magic mock
Aucun commentaire:
Enregistrer un commentaire