summaryrefslogtreecommitdiffstats
path: root/tests/test_client.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2020-12-20 04:17:52 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2020-12-20 04:17:52 -0600
commit05036effb5cc9fcf5899f0e75547c84ac4d9d0e3 (patch)
treed6a6b71ca6c18a1b6bb6a71ab3ec15b43dff2b43 /tests/test_client.py
parentFix formatting (diff)
downloadlirc-05036effb5cc9fcf5899f0e75547c84ac4d9d0e3.zip
Fix tests since `socket` property is gone now
Diffstat (limited to 'tests/test_client.py')
-rw-r--r--tests/test_client.py16
1 files changed, 13 insertions, 3 deletions
diff --git a/tests/test_client.py b/tests/test_client.py
index 523119b..e8096de 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -4,6 +4,12 @@ from lirc import Client, LircdConnection
def test_that_custom_connections_can_be_used(mock_socket):
+ """
+ lirc.Client.__init__
+
+ Ensure we can pass in custom connections using the
+ keyword argument instead of relying on the default.
+ """
connection = LircdConnection(socket=mock_socket)
client = Client(connection=connection)
@@ -22,7 +28,7 @@ def test_that_close_closes_the_socket(mock_client_and_connection):
client.close()
- connection.socket.close.assert_called()
+ connection._LircdConnection__socket.close.assert_called()
@pytest.mark.parametrize(
@@ -61,8 +67,12 @@ def test_that_client_commands_send_the_correct_command(
mock_client_and_connection, client_command, args, lircd_command
):
client, connection = mock_client_and_connection
- connection.socket.recv.return_value = b"BEGIN\nCOMMAND\nSUCCESS\nEND\n"
+ connection._LircdConnection__socket.recv.return_value = (
+ b"BEGIN\nCOMMAND\nSUCCESS\nEND\n"
+ )
getattr(client, client_command)(**args)
- connection.socket.sendall.assert_called_with((lircd_command + "\n").encode("utf-8"))
+ connection._LircdConnection__socket.sendall.assert_called_with(
+ (lircd_command + "\n").encode("utf-8")
+ )