Skip to content

Commit

Permalink
feat: Implement API route to add new "Education"
Browse files Browse the repository at this point in the history
Resolves Implement API route to add new "Education" #19
  • Loading branch information
byhlel committed Sep 24, 2024
1 parent 29ea6b4 commit c66f2b0
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 2 deletions.
12 changes: 11 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,17 @@ def education():
return jsonify({"education": [edu.__dict__ for edu in data["education"]]})

if request.method == 'POST':
return jsonify({})
new_education = request.json
education_instance = Education(
new_education["course"],
new_education["school"],
new_education["start_date"],
new_education["end_date"],
new_education["grade"],
new_education["logo"]
)
data["education"].append(education_instance)
return jsonify({"id": len(data["education"]) - 1})

return jsonify({})

Expand Down
2 changes: 1 addition & 1 deletion test_pytest.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def test_education():
json=example_education).json['id']

response = app.test_client().get('/resume/education')
assert response.json[item_id] == example_education
assert response.json["education"][item_id] == example_education


def test_skill():
Expand Down

0 comments on commit c66f2b0

Please sign in to comment.