Skip to content

Commit

Permalink
add tests
Browse files Browse the repository at this point in the history
  • Loading branch information
MP91 committed Aug 29, 2023
1 parent 9aae3c6 commit 819e578
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/integration/pubsub_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,28 @@ async def test_for_publish_mqtt_event():
assert True


@pytest.mark.asyncio
async def test_for_subscribe_mqtt_event():
mqtt_client = get_vehicleapp_instance().pubsub_client
await mqtt_client.subscribe_topic(
"test/test_for_publish_mqtt_event", successfull_callback
)
await mqtt_client.publish_event("test/test_for_publish_mqtt_event", "test")
assert True


def successfull_callback(self, data_str: str):
assert data_str == "test"


@pytest.mark.asyncio
async def test_for_error_message():
mqtt_client = get_vehicleapp_instance().pubsub_client
await mqtt_client.subscribe_topic("test/test_for_publish_mqtt_event", None)
await mqtt_client.publish_event("test/test_for_publish_mqtt_event", "\xc3")
assert True


class TestPubSubVehicleApp(VehicleApp):
def __init__(self, vehicle_client: Vehicle):
super().__init__()
Expand Down

0 comments on commit 819e578

Please sign in to comment.