import warnings

import paho.mqtt.client as mqtt

from a2a_agent.client import MqttClient


def test_mqtt_client_import_and_creation_do_not_connect(monkeypatch) -> None:
    def fail_connect(*args, **kwargs) -> None:
        raise AssertionError("connect must not be called during client creation")

    monkeypatch.setattr(mqtt.Client, "connect", fail_connect)

    MqttClient()


def test_mqtt_client_creation_has_no_deprecation_warning() -> None:
    with warnings.catch_warnings():
        warnings.simplefilter("error", DeprecationWarning)
        MqttClient()
