Initial commit for resumeformatter project

This commit is contained in:
Laxmi Khilnani
2025-10-14 19:51:35 +05:30
commit ee030b70bc
43 changed files with 1668 additions and 0 deletions

51
backend/test_api.py Normal file
View File

@@ -0,0 +1,51 @@
import requests
import json
import time
# Base URL for the API
BASE_URL = "http://localhost:8080/api"
def test_get_people():
"""Test the GET /api/people endpoint"""
response = requests.get(f"{BASE_URL}/people")
print("GET /api/people")
print(f"Status Code: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2)}")
print("-" * 50)
return response.json()
def test_create_person():
"""Test the POST /api/people endpoint"""
new_person = {
"firstName": "Alan",
"lastName": "Turing",
"linkedinUrl": "https://www.linkedin.com/in/alan-turing"
}
response = requests.post(f"{BASE_URL}/people", json=new_person)
print("POST /api/people")
print(f"Status Code: {response.status_code}")
print(f"Response: {json.dumps(response.json(), indent=2)}")
print("-" * 50)
return response.json()
def run_tests():
"""Run all tests"""
print("Testing API endpoints...")
print("=" * 50)
# Test GET /api/people
people = test_get_people()
# Test POST /api/people
new_person = test_create_person()
# Test GET /api/people again to see the new person
updated_people = test_get_people()
print("Tests completed!")
if __name__ == "__main__":
# Wait a bit for the server to start
print("Waiting for server to start...")
time.sleep(2)
run_tests()