def test_host_required(): """Always needs a host, but it's the only required key""" with pytest.raises(exceptions.MissingKeysError): MQTTClient() args = { "connect": { "host": "localhost", } } MQTTClient(**args)
def fix_fake_client(self): args = { "connect": { "host": "localhost", } } return MQTTClient(**args)
def test_disabled_tls(self): """Even if there are other invalid options, disable tls and early exit without checking other args """ args = { "connect": { "host": "localhost", }, "tls": { "certfile": "/lcliueurhug/ropko3kork32", } } with pytest.raises(exceptions.MQTTTLSError): MQTTClient(**args) args["tls"]["enable"] = False c = MQTTClient(**args) assert not c._enable_tls
def test_invalid_tls_ver(self): """Bad tls versions raise exception """ args = { "connect": { "host": "localhost", }, "tls": { "tls_version": "custom_tls", } } with pytest.raises(exceptions.MQTTTLSError): MQTTClient(**args)