summaryrefslogtreecommitdiff
path: root/servers/hello_world/tests/test_server.py
blob: 13b8f908cc8400879271fd4b8017dc24266cb82d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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