Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding GET all data endpoint #71

Merged
merged 2 commits into from
Sep 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions app.py
Original file line number Diff line number Diff line change
Expand Up @@ -529,3 +529,10 @@ def uploaded_file(filename):
Function for serving uploaded files from /uploads.
"""
return send_from_directory(app.config["UPLOAD_FOLDER"], filename)

@app.route("/resume/data", methods=["GET"])
def get_data():
"""
Get all data from the data.json file
"""
return jsonify(data), 200
12 changes: 12 additions & 0 deletions test_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,19 @@ def reset_data():
"user_information": {"name": "", "email_address": "", "phone_number": ""},
}

def test_get_all_data(client):
data = load_data("data/data.json")
expected_data = {
"experience": [exp.__dict__ for exp in data["experience"]],
"education": [edu.__dict__ for edu in data["education"]],
"skill": [sk.__dict__ for sk in data["skill"]],
"user_information": [inf.__dict__ for inf in data["user_information"]],
}

response = client.get("/resume/data")
assert response.status_code == 200
assert response.json == expected_data

def test_index(client):
"""Test the index route."""
response = client.get("/")
Expand Down
Loading