Browse Source

Add RFC1459 4.1.1 password message

In order to allow the server to handle password message properly, it
should take care of the correct parameters being passed to the function.

Tokenizer is still missing, but should be fine for basic functionality.
master
Sheogorath 5 years ago
parent
commit
73266ab5ea
No known key found for this signature in database GPG Key ID: 1F05CC3635CDDFFD
  1. 3
      src/server.py
  2. 7
      test/test_server.py

3
src/server.py

@ -21,6 +21,9 @@ class Handler_TCPServer(socketserver.BaseRequestHandler):
def ping(self, param):
return "PONG"
def command_pass(self, param):
return param == self.password
if __name__ == "__main__":
HOST, PORT = "localhost", 9999

7
test/test_server.py

@ -6,3 +6,10 @@
def test_ping(server):
assert server.ping(server, "some message") == "PONG"
def test_command_pass(server):
server.password = "password"
assert server.command_pass(server, "password") == True
def test_command_pass_wrong(server):
server.password = "password"
assert server.command_pass(server, "wrong password") == False
Loading…
Cancel
Save