[Django]-Python Mocking of Boolean Function

2👍

From your function here, stream seems to be a class.

Since you create an instance of that class and then you call the open method on that instance, you need to do mock_stream.return_value.open.return_value = False in the test function.

👤poros

Leave a comment