remove dependency on external broker

pull/244/head
Andrew Mirsky 2025-07-02 13:49:16 -04:00
rodzic 03bf1c34d9
commit 4700f49d96
Nie znaleziono w bazie danych klucza dla tego podpisu
ID klucza GPG: A98E67635CDF2C39
2 zmienionych plików z 40 dodań i 4 usunięć

Wyświetl plik

@ -13,8 +13,8 @@ logger = logging.getLogger(__name__)
async def uptime_coro() -> None:
client = MQTTClient()
await client.connect("mqtt://test.mosquitto.org/")
client = MQTTClient(config={'auto_reconnect': False})
await client.connect("mqtt://localhost:1883")
await client.subscribe(
[

Wyświetl plik

@ -200,10 +200,46 @@ async def test_client_publish_ws():
await broker.shutdown()
def test_client_subscribe():
client_subscribe_main()
broker_std_config = {
"listeners": {
"default": {
"type": "tcp",
"bind": "0.0.0.0:1883", }
},
'sys_interval':2,
"auth": {
"allow-anonymous": True,
"plugins": ["auth_anonymous"]
}
}
@pytest.mark.asyncio
async def test_client_subscribe():
# start a standard broker
broker = Broker(config=broker_std_config)
await broker.start()
await asyncio.sleep(1)
# run the sample
client_subscribe_script = Path(__file__).parent.parent / "samples/client_subscribe.py"
process = await asyncio.create_subprocess_shell(
" ".join(["python", str(client_subscribe_script)]),
stdout=asyncio.subprocess.PIPE,
stderr=asyncio.subprocess.PIPE
)
stdout, stderr = await process.communicate()
assert "ERROR" not in stdout.decode("utf-8")
assert "Exception" not in stdout.decode("utf-8")
assert "ERROR" not in stderr.decode("utf-8")
assert "Exception" not in stderr.decode("utf-8")
await broker.shutdown()
@pytest.mark.asyncio
async def test_client_subscribe_plugin_acl():
broker = Broker(config=broker_acl_config)