mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2026-08-30 14:37:14 +00:00
Enhancement: websocket heartbeat (#13739)
--------- Co-authored-by: shamoon <4887959+shamoon@users.noreply.github.com>
This commit is contained in:
co-authored by
shamoon
parent
bab9129ff8
commit
a0908f6b4a
@@ -189,6 +189,23 @@ class TestWebSockets:
|
||||
|
||||
await communicator.disconnect()
|
||||
|
||||
@pytest.mark.anyio
|
||||
async def test_heartbeat(self, mocker: MockerFixture) -> None:
|
||||
mocker.patch(
|
||||
"paperless.consumers.StatusConsumer._authenticated",
|
||||
return_value=True,
|
||||
)
|
||||
mocker.patch("paperless.consumers.HEARTBEAT_INTERVAL", 0.01)
|
||||
|
||||
communicator = WebsocketCommunicator(application, "/ws/status/")
|
||||
connected, _ = await communicator.connect()
|
||||
assert connected
|
||||
|
||||
assert await communicator.receive_json_from() == {"type": "heartbeat"}
|
||||
assert await communicator.receive_json_from() == {"type": "heartbeat"}
|
||||
|
||||
await communicator.disconnect()
|
||||
|
||||
def test_manager_send_progress(self, mocker: MockerFixture) -> None:
|
||||
mock_group_send = mocker.patch(
|
||||
"channels.layers.InMemoryChannelLayer.group_send",
|
||||
|
||||
Reference in New Issue
Block a user