Skip to content

Commit

Permalink
refactor!: rename Server.acknowledge_authentication
Browse files Browse the repository at this point in the history
For simplicity, make the method name in parity with Client
  • Loading branch information
thegamecracks committed Mar 13, 2024
1 parent 8a79e54 commit 67ac213
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion src/dumdum/protocol/server/protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion src/dumdum/server.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down
8 changes: 4 additions & 4 deletions tests/test_protocol.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 == []
Expand Down Expand Up @@ -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,
Expand All @@ -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 == []
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 67ac213

Please sign in to comment.