Example #1
0
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)
Example #2
0
    def fix_fake_client(self):
        args = {
            "connect": {
                "host": "localhost",
            }
        }

        return MQTTClient(**args)
Example #3
0
    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
Example #4
0
    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)