From 1745749cd2745c94c3f852e9c02dfde19d8d9c20 Mon Sep 17 00:00:00 2001 From: Dawid Rycerz Date: Fri, 28 Mar 2025 20:53:41 +0100 Subject: Fix ruff errors and warnings in hello_world service --- servers/hello_world/tests/test_server.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 servers/hello_world/tests/test_server.py (limited to 'servers/hello_world/tests/test_server.py') 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 -- cgit v1.2.3