File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1- 3718911
2- 3719524
3- 3719833
4- 3720298
1+ 449273
2+ 449274
3+ 449275
4+ 449339
Original file line number Diff line number Diff line change 1+ #!/usr/bin/env python3
2+
3+ import requests
4+ import json
5+ import sys
6+
7+ def test_auth_connectivity ():
8+ """Test basic auth service connectivity"""
9+
10+ print ("Testing Auth Service Connectivity..." )
11+
12+ # Test health endpoint
13+ try :
14+ response = requests .get ("http://localhost:8082/health" , timeout = 5 )
15+ print (f"✅ Health endpoint: HTTP { response .status_code } " )
16+ if response .status_code == 200 :
17+ print (f" Response: { response .text [:200 ]} " )
18+ except Exception as e :
19+ print (f"❌ Health endpoint failed: { e } " )
20+ return False
21+
22+ # Test login endpoint
23+ try :
24+ login_data = {
25+ "email" : "test@example.com" ,
26+ "password" : "password"
27+ }
28+ response = requests .post (
29+ "http://localhost:8082/login" ,
30+ json = login_data ,
31+ timeout = 5
32+ )
33+ print (f"✅ Login endpoint: HTTP { response .status_code } " )
34+ if response .status_code == 200 :
35+ token_data = response .json ()
36+ print (f" Token received: { token_data .get ('access_token' , 'No token' )[:50 ]} ..." )
37+ else :
38+ print (f" Response: { response .text [:200 ]} " )
39+ except Exception as e :
40+ print (f"❌ Login endpoint failed: { e } " )
41+ return False
42+
43+ return True
44+
45+ if __name__ == "__main__" :
46+ if test_auth_connectivity ():
47+ print ("\n ✅ Auth service connectivity test passed!" )
48+ sys .exit (0 )
49+ else :
50+ print ("\n ❌ Auth service connectivity test failed!" )
51+ sys .exit (1 )
You can’t perform that action at this time.
0 commit comments