diff --git a/CHANGELOG.md b/CHANGELOG.md index 7b2ca5a..3c5e020 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,7 +16,7 @@ usually after receiving `ServerEventListMessages`. ### Added - More test coverage of the protocol -- `Server.acknowledge_authentication()` method +- `Server.authenticate()` method - `Server.list_channels()` method - `ServerEventListChannels` type - `ClientEventMessagesListed` type diff --git a/src/dumdum/protocol/server/protocol.py b/src/dumdum/protocol/server/protocol.py index 49d5aed..ba39115 100644 --- a/src/dumdum/protocol/server/protocol.py +++ b/src/dumdum/protocol/server/protocol.py @@ -50,7 +50,7 @@ def receive_bytes(self, data: bytes) -> ParsedData: self._buffer.extend(data) return self._maybe_parse_buffer() - def acknowledge_authentication(self, *, success: bool) -> bytes: + def authenticate(self, *, success: bool) -> bytes: self._assert_state(ServerState.AWAITING_AUTHENTICATION) if success: diff --git a/src/dumdum/server.py b/src/dumdum/server.py index c53c1b7..a2c5f77 100644 --- a/src/dumdum/server.py +++ b/src/dumdum/server.py @@ -154,7 +154,7 @@ def _authenticate(self, conn: Connection, event: ServerEventAuthentication) -> N else: success = False - data = conn.server.acknowledge_authentication(success=success) + data = conn.server.authenticate(success=success) conn.writer.write(data) def _broadcast_message( diff --git a/tests/test_protocol.py b/tests/test_protocol.py index d3334c9..e5057c2 100644 --- a/tests/test_protocol.py +++ b/tests/test_protocol.py @@ -74,7 +74,7 @@ def test_authenticate(): assert client_events == [] assert server_events == [ServerEventAuthentication(nick=nick)] - data = server.acknowledge_authentication(success=True) + data = server.authenticate(success=True) server_events, client_events = communicate(server, data, client) assert client_events == [ClientEventAuthentication(success=True)] assert server_events == [] @@ -114,7 +114,7 @@ def test_send_message(): server = Server() communicate(client, client.authenticate(), server) - communicate(server, server.acknowledge_authentication(success=True), client) + communicate(server, server.authenticate(success=True), client) client_events, server_events = communicate( client, @@ -138,7 +138,7 @@ def test_list_channels(): server = Server() communicate(client, client.authenticate(), server) - communicate(server, server.acknowledge_authentication(success=True), client) + communicate(server, server.authenticate(success=True), client) client_events, server_events = communicate(client, client.list_channels(), server) assert client_events == [] @@ -194,7 +194,7 @@ def test_list_messages(): server = Server() communicate(client, client.authenticate(), server) - communicate(server, server.acknowledge_authentication(success=True), client) + communicate(server, server.authenticate(success=True), client) before = 1 after = 2