Skip to content

Commit

Permalink
Add client connection test #225
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickjaigner committed Jul 15, 2024
1 parent aec8855 commit bb7a76a
Showing 1 changed file with 13 additions and 3 deletions.
16 changes: 13 additions & 3 deletions tests/integration/test_thingsboard_connection.py
Original file line number Diff line number Diff line change
@@ -1,11 +1,21 @@
import pytest
from packages.core import types
from tb_device_mqtt import TBDeviceMqttClient # type: ignore
import time


@pytest.mark.integration
def test_uploading() -> None:
def test_thingsboard_connection() -> None:
config = types.Config.load()
if config.upload is None:
if config.thingsboard is None:
return

raise Exception("Could not establish a connection to ThingsBoard.")
# initialize MQTT client
client = TBDeviceMqttClient(
config.thingsboard.host, username=config.thingsboard.access_token
)

client.connect()
time.sleep(2)
assert client.is_connected()
client.disconnect()

0 comments on commit bb7a76a

Please sign in to comment.