summaryrefslogtreecommitdiffstats
path: root/tests/test_client.py
diff options
context:
space:
mode:
authorEugene Triguba <eugenetriguba@gmail.com>2021-11-28 17:58:09 -0600
committerEugene Triguba <eugenetriguba@gmail.com>2021-11-28 17:58:09 -0600
commitc1eaaca5a370b384b8b6fea4b385bbe676021bdc (patch)
tree2f9ce3a67fe3f12fb0112286eda7e623e509dcec /tests/test_client.py
parentMove maintenance section (diff)
downloadlirc-c1eaaca5a370b384b8b6fea4b385bbe676021bdc.zip
Use single underscore internal attribute prefixes
Diffstat (limited to 'tests/test_client.py')
-rw-r--r--tests/test_client.py22
1 files changed, 8 insertions, 14 deletions
diff --git a/tests/test_client.py b/tests/test_client.py
index e7b80d5..b930f5d 100644
--- a/tests/test_client.py
+++ b/tests/test_client.py
@@ -17,7 +17,7 @@ def test_that_custom_connections_can_be_used(mock_socket):
client = Client(connection=connection) # SUT
- assert client._Client__connection == connection
+ assert client._connection == connection
def test_that_custom_connection_that_is_not_an_abstract_connection_raises_error(
@@ -50,7 +50,7 @@ def test_that_no_connection_passed_in_creates_default_one():
with mock.patch("lirc.client.LircdConnection", MockedLircdConnection):
c = Client()
- assert isinstance(c._Client__connection, MockedLircdConnection)
+ assert isinstance(c._connection, MockedLircdConnection)
def test_that_close_closes_the_socket(mock_client_and_connection):
@@ -63,7 +63,7 @@ def test_that_close_closes_the_socket(mock_client_and_connection):
client.close() # SUT
- connection._LircdConnection__socket.close.assert_called()
+ connection._socket.close.assert_called()
@pytest.mark.parametrize(
@@ -124,13 +124,11 @@ def test_that_client_commands_send_the_correct_command(
lircd_command: The expected corresponding command sent to lircd.
"""
client, connection = mock_client_and_connection
- connection._LircdConnection__socket.recv.return_value = (
- b"BEGIN\nCOMMAND\nSUCCESS\nEND\n"
- )
+ connection._socket.recv.return_value = b"BEGIN\nCOMMAND\nSUCCESS\nEND\n"
getattr(client, client_command)(**args) # SUT
- connection._LircdConnection__socket.sendall.assert_called_with(
+ connection._socket.sendall.assert_called_with(
(lircd_command + "\n").encode("utf-8")
)
@@ -143,9 +141,7 @@ def test_unsuccessful_command_raises_custom_exception(mock_client_and_connection
LircdCommandFailureError.
"""
client, connection = mock_client_and_connection
- connection._LircdConnection__socket.recv.return_value = (
- b"BEGIN\nCOMMAND\nERROR\nEND\n"
- )
+ connection._socket.recv.return_value = b"BEGIN\nCOMMAND\nERROR\nEND\n"
with pytest.raises(LircdCommandFailureError) as error:
client.send_once("remote", "key")
@@ -163,13 +159,11 @@ def test_last_send_start_remote_and_key_is_used(mock_client_and_connection):
had passed in as args if no args are provided to send_stop.
"""
client, connection = mock_client_and_connection
- connection._LircdConnection__socket.recv.return_value = (
- b"BEGIN\nCOMMAND\nSUCCESS\nEND\n"
- )
+ connection._socket.recv.return_value = b"BEGIN\nCOMMAND\nSUCCESS\nEND\n"
client.send_start("remote", "key")
client.send_stop() # SUT
- connection._LircdConnection__socket.sendall.assert_called_with(
+ connection._socket.sendall.assert_called_with(
"SEND_STOP remote key\n".encode("utf-8")
)