LinkDesk/backend/test_global_settings.py

37 lines
1.2 KiB
Python

#!/usr/bin/env python3
"""
Test script for global settings functionality.
"""
import requests
import json
BASE_URL = "http://localhost:8000"
def test_global_settings():
"""Test the global settings endpoints."""
print("Testing Global Settings API...")
# Test getting upload limit (should work without auth for basic info)
try:
response = requests.get(f"{BASE_URL}/settings/upload-limit")
print(f"GET /settings/upload-limit: {response.status_code}")
if response.status_code == 200:
data = response.json()
print(f" Upload limit: {data['upload_limit_mb']} MB")
print(f" Description: {data['description']}")
else:
print(f" Error: {response.text}")
except Exception as e:
print(f" Connection error: {e}")
print("\nNote: Admin endpoints require authentication")
print("To test admin functionality:")
print("1. Start the backend server: python -m uvicorn main:app --reload --port 8000")
print("2. Start the frontend: npm run dev")
print("3. Login as an admin user")
print("4. Navigate to /settings to test the global settings interface")
if __name__ == "__main__":
test_global_settings()