summaryrefslogtreecommitdiff
path: root/servers/hello_world/tests/test_server.py
diff options
context:
space:
mode:
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