-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathtest_current_user.py
More file actions
executable file
·48 lines (36 loc) · 1.29 KB
/
test_current_user.py
File metadata and controls
executable file
·48 lines (36 loc) · 1.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/bin/env python3
"""
Test script to check the /api/current-user endpoint
"""
import requests
def test_current_user_endpoint():
"""Test the current user endpoint"""
url = "http://0.0.0.0:8083/api/current-user"
try:
print(f"Testing endpoint: {url}")
response = requests.get(url, timeout=10)
print(f"Status code: {response.status_code}")
print(f"Headers: {dict(response.headers)}")
if response.status_code == 200:
print(f"Response body: {response.json()}")
else:
print(f"Response text: {response.text}")
except requests.exceptions.ConnectionError as e:
print(f"Connection error: {e}")
except requests.exceptions.Timeout as e:
print(f"Timeout error: {e}")
except Exception as e:
print(f"Other error: {e}")
def test_health_endpoint():
"""Test a simple health check"""
url = "http://0.0.0.0:8083/"
try:
print(f"\nTesting health endpoint: {url}")
response = requests.get(url, timeout=10)
print(f"Status code: {response.status_code}")
print(f"Response length: {len(response.text)} chars")
except Exception as e:
print(f"Health check error: {e}")
if __name__ == "__main__":
test_health_endpoint()
test_current_user_endpoint()