Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions tests/test_client.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
from importlib.resources import files

import pytest
from unittest.mock import AsyncMock

from werk24 import (
AskMetaData,
Expand Down Expand Up @@ -50,17 +51,16 @@ async def test_read_drawing(drawing_bytes):

@pytest.mark.asyncio
async def test_read_drawing_with_hooks(drawing_bytes):
received = False
hook = AsyncMock()

def recv(msg):
nonlocal received
received = True

hooks = [Hook(ask=AskMetaData(), function=recv)]
hooks = [Hook(ask=AskMetaData(), function=hook)]
async with Werk24Client() as client:
await client.read_drawing_with_hooks(drawing_bytes, hooks)

assert received
hook.assert_called_once()
assert (
hook.call_args.args[0].message_type == TechreadMessageType.ASK
)


@pytest.mark.asyncio
Expand Down
Loading