diff --git a/app.py b/app.py index c0a7d07..3c32cbe 100644 --- a/app.py +++ b/app.py @@ -54,7 +54,17 @@ def experience(): return jsonify({"experience": [exp.__dict__ for exp in data["experience"]]}) if request.method == 'POST': - return jsonify({}) + new_experience = request.json + experience_instance = Experience( + new_experience["title"], + new_experience["company"], + new_experience["start_date"], + new_experience["end_date"], + new_experience["description"], + new_experience["logo"] + ) + data["experience"].append(experience_instance) + return jsonify({"id": len(data["experience"]) - 1}) return jsonify({}) diff --git a/test_pytest.py b/test_pytest.py index 045da6c..392f594 100644 --- a/test_pytest.py +++ b/test_pytest.py @@ -31,7 +31,7 @@ def test_experience(): item_id = app.test_client().post('/resume/experience', json=example_experience).json['id'] response = app.test_client().get('/resume/experience') - assert response.json[item_id] == example_experience + assert response.json["experience"][item_id] == example_experience def test_education():