test: Let mocker.path.object figure out the mock type to use in packet stream tests
This commit is contained in:
parent
d51f27d883
commit
3b2c5cc792
@ -266,9 +266,7 @@ async def test_message_stream(ps_client, mocker): # pylint: disable=redefined-o
|
|||||||
assert ps.req_counter == 2
|
assert ps.req_counter == 2
|
||||||
assert ps.register_handler.call_count == 1 # pylint: disable=no-member
|
assert ps.register_handler.call_count == 1 # pylint: disable=no-member
|
||||||
handler = list(ps._event_map.values())[0][1] # pylint: disable=protected-access
|
handler = list(ps._event_map.values())[0][1] # pylint: disable=protected-access
|
||||||
mock_process = mocker.AsyncMock()
|
mock_process = mocker.patch.object(handler, "process")
|
||||||
|
|
||||||
mocker.patch.object(handler, "process", mock_process)
|
|
||||||
|
|
||||||
ps_client.feed([b"\n\x00\x00\x02\xc5\xff\xff\xff\xff", MSG_BODY_1])
|
ps_client.feed([b"\n\x00\x00\x02\xc5\xff\xff\xff\xff", MSG_BODY_1])
|
||||||
msg = await ps.read()
|
msg = await ps.read()
|
||||||
@ -342,9 +340,7 @@ async def test_message_request(ps_server, mocker): # pylint: disable=redefined-
|
|||||||
assert ps.req_counter == 2
|
assert ps.req_counter == 2
|
||||||
assert ps.register_handler.call_count == 1 # pylint: disable=no-member
|
assert ps.register_handler.call_count == 1 # pylint: disable=no-member
|
||||||
handler = list(ps._event_map.values())[0][1] # pylint: disable=protected-access
|
handler = list(ps._event_map.values())[0][1] # pylint: disable=protected-access
|
||||||
mock_process = mocker.AsyncMock()
|
mock_process = mocker.patch.object(handler, "process")
|
||||||
|
|
||||||
mocker.patch.object(handler, "process", mock_process)
|
|
||||||
ps_server.feed(
|
ps_server.feed(
|
||||||
[
|
[
|
||||||
b"\x02\x00\x00\x00>\xff\xff\xff\xff",
|
b"\x02\x00\x00\x00>\xff\xff\xff\xff",
|
||||||
|
Loading…
Reference in New Issue
Block a user