Browse Source

implement test_ping function

master
Wayne 5 years ago
parent
commit
b9f827e296
  1. 14
      conftest.py
  2. 7
      test/test_Server.py

14
conftest.py

@ -1,23 +1,13 @@
"""
setup the fixtures for our test
"""
import socketserver
import pytest
@pytest.fixture()
def server():
"""
starts the server
returns a fresh server instance
"""
from src.server import Handler_TCPServer
HOST, PORT = "localhost", 9999
# Init the TCP server object, bind it to the localhost on 9999 port
tcp_server = socketserver.TCPServer((HOST, PORT), Handler_TCPServer)
# Activate the TCP server.
# To abort the TCP server, press Ctrl-C.
tcp_server.serve_forever()
return Handler_TCPServer

7
test/test_Server.py

@ -0,0 +1,7 @@
"""
tests the server functionality
"""
def test_ping(server):
assert server.ping(server, "some message") == "PONG"
Loading…
Cancel
Save