| |
| """ |
| 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...") |
|
|
| |
| 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}") |
|
|
| |
| 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__": |
| |
| time.sleep(2) |
|
|
| try: |
| test_nickname_api() |
| test_board_page() |
| print("\nβ
All tests completed!") |
| except Exception as e: |
| print(f"β Test failed: {e}") |
|
|