-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
♻️ Migrate tests from hbmqtt to aiomqtt
- Loading branch information
Showing
16 changed files
with
526 additions
and
730 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,55 +1,72 @@ | ||
#!/usr/bin/env python | ||
# -*- coding: utf-8 -*- | ||
|
||
from tests.protocols.helpers import \ | ||
client_test_on_property_change, \ | ||
client_test_on_event, \ | ||
client_test_read_property, \ | ||
client_test_write_property, \ | ||
client_test_invoke_action, \ | ||
client_test_invoke_action_error, \ | ||
client_test_on_property_change_error | ||
import pytest | ||
|
||
from tests.protocols.helpers import ( | ||
client_test_invoke_action_async, | ||
client_test_invoke_action_error_async, | ||
client_test_on_event_async, | ||
client_test_on_property_change_async, | ||
client_test_on_property_change_error_async, | ||
client_test_read_property_async, | ||
client_test_write_property_async, | ||
) | ||
from wotpy.protocols.coap.client import CoAPClient | ||
|
||
|
||
def test_read_property(coap_servient): | ||
"""The CoAP client can read properties.""" | ||
@pytest.mark.asyncio | ||
async def test_read_property(coap_servient): | ||
"""Property values may be retrieved using the CoAP binding client.""" | ||
|
||
client_test_read_property(coap_servient, CoAPClient) | ||
async for servient in coap_servient: | ||
await client_test_read_property_async(servient, CoAPClient) | ||
|
||
|
||
def test_write_property(coap_servient): | ||
"""The CoAP client can write properties.""" | ||
@pytest.mark.asyncio | ||
async def test_write_property(coap_servient): | ||
"""Properties may be updated using the CoAP binding client.""" | ||
|
||
client_test_write_property(coap_servient, CoAPClient) | ||
async for servient in coap_servient: | ||
await client_test_write_property_async(servient, CoAPClient) | ||
|
||
|
||
def test_on_property_change(coap_servient): | ||
@pytest.mark.asyncio | ||
async def test_on_property_change(coap_servient): | ||
"""The CoAP client can subscribe to property updates.""" | ||
|
||
client_test_on_property_change(coap_servient, CoAPClient) | ||
async for servient in coap_servient: | ||
await client_test_on_property_change_async(servient, CoAPClient) | ||
|
||
|
||
def test_on_property_change_error(coap_servient): | ||
"""Errors that arise in the middle of an ongoing Property | ||
observation are propagated to the subscription as expected.""" | ||
@pytest.mark.asyncio | ||
async def test_invoke_action(coap_servient): | ||
"""The CoAP client can invoke actions.""" | ||
|
||
client_test_on_property_change_error(coap_servient, CoAPClient) | ||
async for servient in coap_servient: | ||
await client_test_invoke_action_async(servient, CoAPClient) | ||
|
||
|
||
def test_invoke_action(coap_servient): | ||
"""The CoAP client can invoke actions.""" | ||
@pytest.mark.asyncio | ||
async def test_on_event(coap_servient): | ||
"""The CoAP client can subscribe to event emissions.""" | ||
|
||
client_test_invoke_action(coap_servient, CoAPClient) | ||
async for servient in coap_servient: | ||
await client_test_on_event_async(servient, CoAPClient) | ||
|
||
|
||
def test_invoke_action_error(coap_servient): | ||
@pytest.mark.asyncio | ||
async def test_invoke_action_error(coap_servient): | ||
"""Errors raised by Actions are propagated propertly by the CoAP binding client.""" | ||
|
||
client_test_invoke_action_error(coap_servient, CoAPClient) | ||
async for servient in coap_servient: | ||
await client_test_invoke_action_error_async(servient, CoAPClient) | ||
|
||
|
||
def test_on_event(coap_servient): | ||
"""The CoAP client can subscribe to event emissions.""" | ||
@pytest.mark.asyncio | ||
async def test_on_property_change_error(coap_servient): | ||
"""Errors that arise in the middle of an ongoing Property | ||
observation are propagated to the subscription as expected.""" | ||
|
||
client_test_on_event(coap_servient, CoAPClient) | ||
async for servient in coap_servient: | ||
await client_test_on_property_change_error_async(servient, CoAPClient) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.