Skip to content

Commit f5e4c4e

Browse files
authored
Merge pull request #71 from yalsaffar/get-data-endpoint
Adding GET all data endpoint
2 parents 8e6d60e + dd3d124 commit f5e4c4e

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

app.py

+7
Original file line numberDiff line numberDiff line change
@@ -529,3 +529,10 @@ def uploaded_file(filename):
529529
Function for serving uploaded files from /uploads.
530530
"""
531531
return send_from_directory(app.config["UPLOAD_FOLDER"], filename)
532+
533+
@app.route("/resume/data", methods=["GET"])
534+
def get_data():
535+
"""
536+
Get all data from the data.json file
537+
"""
538+
return jsonify(data), 200

test_pytest.py

+12
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,19 @@ def reset_data():
4545
"user_information": {"name": "", "email_address": "", "phone_number": ""},
4646
}
4747

48+
def test_get_all_data(client):
49+
data = load_data("data/data.json")
50+
expected_data = {
51+
"experience": [exp.__dict__ for exp in data["experience"]],
52+
"education": [edu.__dict__ for edu in data["education"]],
53+
"skill": [sk.__dict__ for sk in data["skill"]],
54+
"user_information": [inf.__dict__ for inf in data["user_information"]],
55+
}
4856

57+
response = client.get("/resume/data")
58+
assert response.status_code == 200
59+
assert response.json == expected_data
60+
4961
def test_index(client):
5062
"""Test the index route."""
5163
response = client.get("/")

0 commit comments

Comments
 (0)