Skip to content

Commit 0246a81

Browse files
committed
coverage
1 parent fdf6bd6 commit 0246a81

File tree

1 file changed

+18
-1
lines changed

1 file changed

+18
-1
lines changed

tests/asyncio/test_grpc_helpers_async.py

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ async def test_wrap_stream_errors_raised():
186186

187187

188188
@pytest.mark.asyncio
189-
async def test_wrap_stream_errors_read():
189+
async def test_wrap_stream_errors_read_with_grpc_error():
190190
grpc_error = RpcErrorImpl(grpc.StatusCode.INVALID_ARGUMENT)
191191

192192
mock_call = mock.Mock(aio.StreamStreamCall, autospec=True)
@@ -206,6 +206,23 @@ async def test_wrap_stream_errors_read():
206206
assert exc_info.value.response == grpc_error
207207

208208

209+
@pytest.mark.asyncio
210+
async def test_wrap_stream_errors_read_without_grpc_error():
211+
mock_call = mock.Mock(aio.StreamStreamCall, autospec=True)
212+
213+
mock_call.read = mock.AsyncMock()
214+
multicallable = mock.Mock(return_value=mock_call)
215+
216+
wrapped_callable = grpc_helpers_async._wrap_stream_errors(
217+
multicallable, grpc_helpers_async._WrappedStreamStreamCall
218+
)
219+
220+
wrapped_call = await wrapped_callable(1, 2, three="four")
221+
multicallable.assert_called_once_with(1, 2, three="four")
222+
assert mock_call.wait_for_connection.call_count == 1
223+
await wrapped_call.read()
224+
225+
209226
@pytest.mark.asyncio
210227
async def test_wrap_stream_errors_aiter():
211228
grpc_error = RpcErrorImpl(grpc.StatusCode.INVALID_ARGUMENT)

0 commit comments

Comments
 (0)