summaryrefslogtreecommitdiff
path: root/servers/hello_world/tests/test_server.py
diff options
context:
space:
mode:
authorDawid Rycerz <dawid@rycerz.xyz>2025-03-28 20:53:41 +0100
committerDawid Rycerz <dawid@rycerz.xyz>2025-03-28 20:53:41 +0100
commit1745749cd2745c94c3f852e9c02dfde19d8d9c20 (patch)
tree8ed13f3de5fac78d804124e27fbcf1b678e83253 /servers/hello_world/tests/test_server.py
Fix ruff errors and warnings in hello_world service
Diffstat (limited to 'servers/hello_world/tests/test_server.py')
-rw-r--r--servers/hello_world/tests/test_server.py22
1 files changed, 22 insertions, 0 deletions
diff --git a/servers/hello_world/tests/test_server.py b/servers/hello_world/tests/test_server.py
new file mode 100644
index 0000000..13b8f90
--- /dev/null
+++ b/servers/hello_world/tests/test_server.py
@@ -0,0 +1,22 @@
+import pytest
+from mcp_server_hello_world.server import HelloWorldServer
+
+class TestHelloWorldServer:
+ """Test the HelloWorldServer class functionality."""
+
+ def test_init(self):
+ """Test that the server initializes with the correct welcome message."""
+ server = HelloWorldServer()
+ assert server.welcome_message == "Welcome to the Hello World MCP Server! This is a simple static resource."
+
+ def test_get_greeting(self):
+ """Test that the get_greeting method returns the correct greeting."""
+ server = HelloWorldServer()
+ name = "Test User"
+ expected_greeting = f"Hello, {name}! Welcome to the Hello World MCP Server."
+ assert server.get_greeting(name) == expected_greeting
+
+ # Test with different name
+ another_name = "Another User"
+ expected_greeting = f"Hello, {another_name}! Welcome to the Hello World MCP Server."
+ assert server.get_greeting(another_name) == expected_greeting