diff --git a/docker-compose.yml b/docker-compose.yml index 42f453b..b9191f4 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,10 +1,16 @@ services: - internetnews-server: + internetnews-server-austin: image: cclauss/inn ports: - 119:119 - 563:563 + internetnews-server-boston: + image: cclauss/inn + ports: + - 1119:119 + - 1563:563 + fastapi-server: image: fastapi build: @@ -15,7 +21,8 @@ services: ports: - 5001:5001 depends_on: - - internetnews-server + - internetnews-server-austin + - internetnews-server-boston imls-react: image: imlsreact diff --git a/server/ome_node.py b/server/ome_node.py index 1f22cc1..c5b4d9e 100644 --- a/server/ome_node.py +++ b/server/ome_node.py @@ -6,6 +6,8 @@ from server.schemas import Card, Channel, ChannelSummary, Metadata, NewCard +AUSTIN_PORT = 119 +BOSTON_PORT = AUSTIN_PORT + 1000 DEFAULT_NEWSGROUPS: dict[str, str] = { ("control.cancel", "Cancel messages (no posting)"), ("control.checkgroups", "Hierarchy check control messages (no posting)"), @@ -20,9 +22,9 @@ CLIENT: nntp.NNTPClient | None = None -def get_client() -> nntp.NNTPClient: +def get_client(port: int = 119) -> nntp.NNTPClient: global CLIENT # noqa: PLW0603 - CLIENT = CLIENT or nntp.NNTPClient("localhost") + CLIENT = CLIENT or nntp.NNTPClient("localhost", port=port) return CLIENT diff --git a/tests/test_ome_node.py b/tests/test_ome_node.py index 9338589..1ec489c 100644 --- a/tests/test_ome_node.py +++ b/tests/test_ome_node.py @@ -6,9 +6,13 @@ from server import ome_node +AUSTIN_PORT = 119 +BOSTON_PORT = AUSTIN_PORT + 1000 -def test_nntp_client() -> None: - nntp_client = ome_node.get_client() + +@pytest.mark.parametrize("port", [AUSTIN_PORT, BOSTON_PORT]) +def test_nntp_client(port: int) -> None: + nntp_client = ome_node.get_client(port=port) assert isinstance(nntp_client, ome_node.nntp.NNTPClient) newsgroups = set(nntp_client.list_newsgroups()) assert newsgroups == ome_node.DEFAULT_NEWSGROUPS