File size: 760 Bytes
a720bd6
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
import requests

# Test if the endpoint exists and returns proper error for unauthorized access
BASE_URL = "http://localhost:8000"

def test_unauthorized_access():
    """Test that the endpoint requires authentication"""
    response = requests.get(f"{BASE_URL}/applications/my-applications")
    
    print(f"Status Code: {response.status_code}")
    print(f"Response: {response.json()}")
    
    # Should return 403 Forbidden since no token is provided
    assert response.status_code == 403, f"Expected 403, got {response.status_code}"
    print("OK - Endpoint correctly requires authentication")

if __name__ == "__main__":
    print("Testing the new 'my-applications' endpoint...")
    test_unauthorized_access()
    print("Test completed successfully!")