#!/usr/bin/env python3 """ Test script for the new nickname and @pseudo features """ import requests import time BASE_URL = "http://127.0.0.1:5000" def test_nickname_api(): """Test the nickname API""" print("Testing nickname API...") # Test set nickname response = requests.post( f"{BASE_URL}/api/set-nickname", json={"nickname": "TestUser123"} ) print(f"Set nickname response: {response.status_code}") data = response.json() print(f"Response: {data}") # Test get current user response = requests.get(f"{BASE_URL}/api/me") print(f"Get user response: {response.status_code}") data = response.json() print(f"Current user: {data}") def test_board_page(): """Test accessing a board page""" print("\nTesting board page...") response = requests.get(f"{BASE_URL}/g/") print(f"Board page response: {response.status_code}") if "nickname-modal" in response.text: print("āœ… Nickname modal found on board page") else: print("āŒ Nickname modal not found") if __name__ == "__main__": # Wait for server to start time.sleep(2) try: test_nickname_api() test_board_page() print("\nāœ… All tests completed!") except Exception as e: print(f"āŒ Test failed: {e}")