1
0
forked from ScoDoc/ScoDoc

renomme /billets_absence/add en /billets_absence/create

This commit is contained in:
Emmanuel Viennet 2022-08-02 08:48:08 +02:00
parent 338e2a1c3f
commit bfec7b7a6d
2 changed files with 6 additions and 6 deletions

View File

@ -33,12 +33,12 @@ def billets_absence_etudiant(etudid: int):
return jsonify([billet.to_dict() for billet in billets]) return jsonify([billet.to_dict() for billet in billets])
@bp.route("/billets_absence/add", methods=["POST"]) @bp.route("/billets_absence/create", methods=["POST"])
@api_web_bp.route("/billets_absence/add", methods=["POST"]) @api_web_bp.route("/billets_absence/create", methods=["POST"])
@login_required @login_required
@scodoc @scodoc
@permission_required(Permission.ScoAbsAddBillet) @permission_required(Permission.ScoAbsAddBillet)
def billets_absence_add(): def billets_absence_create():
"""Ajout d'un billet d'absence""" """Ajout d'un billet d'absence"""
data = request.get_json(force=True) # may raise 400 Bad Request data = request.get_json(force=True) # may raise 400 Bad Request
etudid = data.get("etudid") etudid = data.get("etudid")

View File

@ -18,7 +18,7 @@ def test_billets(api_headers):
Ajout, Liste, Suppression billets absences Ajout, Liste, Suppression billets absences
Routes : Routes :
- /billets_absence/add - /billets_absence/create
- /billets_absence/etudiant/<int:etudid>[?format=xml|json] - /billets_absence/etudiant/<int:etudid>[?format=xml|json]
- /billets_absence/delete - /billets_absence/delete
""" """
@ -28,7 +28,7 @@ def test_billets(api_headers):
abs_end="2022-08-01", abs_end="2022-08-01",
description="test 1", description="test 1",
) )
billet_r = POST_JSON("/billets_absence/add", billet_d, headers=api_headers) billet_r = POST_JSON("/billets_absence/create", billet_d, headers=api_headers)
assert billet_r["etudid"] == billet_d["etudid"] assert billet_r["etudid"] == billet_d["etudid"]
assert datetime.datetime.fromisoformat(billet_r["abs_begin"]).replace( assert datetime.datetime.fromisoformat(billet_r["abs_begin"]).replace(
tzinfo=None tzinfo=None
@ -43,7 +43,7 @@ def test_billets(api_headers):
abs_end="2022-08-03", abs_end="2022-08-03",
description="test 2", description="test 2",
) )
billet_r = POST_JSON("/billets_absence/add", billet_d2, headers=api_headers) billet_r = POST_JSON("/billets_absence/create", billet_d2, headers=api_headers)
billets = GET("/billets_absence/etudiant/1", headers=api_headers) billets = GET("/billets_absence/etudiant/1", headers=api_headers)
assert len(billets) == 2 assert len(billets) == 2
# Suppression # Suppression