4
4
5
5
"""tests that verify the connect behavior w.r.t. port number and TLS"""
6
6
7
- import pytest
8
7
import socket
9
8
import ssl
10
9
from unittest .mock import Mock , call , patch
11
10
11
+ import pytest
12
12
import adafruit_minimqtt .adafruit_minimqtt as MQTT
13
13
14
14
@@ -17,6 +17,7 @@ class TestPortSslSetup:
17
17
These tests assume that there is no MQTT broker running on the hosts/ports they connect to.
18
18
"""
19
19
20
+ # pylint: disable=no-self-use
20
21
def test_default_port (self ) -> None :
21
22
"""verify default port value and that TLS is not used"""
22
23
host = "127.0.0.1"
@@ -44,6 +45,7 @@ def test_default_port(self) -> None:
44
45
# Assuming the repeated calls will have the same arguments.
45
46
connect_mock .assert_has_calls ([call ((host , expected_port ))])
46
47
48
+ # pylint: disable=no-self-use
47
49
def test_connect_override (self ):
48
50
"""Test that connect() can override host and port."""
49
51
host = "127.0.0.1"
@@ -69,6 +71,7 @@ def test_connect_override(self):
69
71
# Assuming the repeated calls will have the same arguments.
70
72
connect_mock .assert_has_calls ([call ((expected_host , expected_port ))])
71
73
74
+ # pylint: disable=no-self-use
72
75
@pytest .mark .parametrize ("port" , (None , 8883 ))
73
76
def test_tls_port (self , port ) -> None :
74
77
"""verify that when is_ssl=True is set, the default port is 8883
@@ -104,6 +107,7 @@ def test_tls_port(self, port) -> None:
104
107
# Assuming the repeated calls will have the same arguments.
105
108
connect_mock .assert_has_calls ([call ((host , expected_port ))])
106
109
110
+ # pylint: disable=no-self-use
107
111
def test_tls_without_ssl_context (self ) -> None :
108
112
"""verify that when is_ssl=True is set, the code will check that ssl_context is not None"""
109
113
host = "127.0.0.1"
0 commit comments