diff --git a/src/bench/locustfile.py b/src/bench/locustfile.py index cf0298f9..34f700f8 100644 --- a/src/bench/locustfile.py +++ b/src/bench/locustfile.py @@ -3,6 +3,7 @@ import os from datetime import datetime, timedelta, timezone from functools import cache +from http import HTTPStatus from pathlib import Path import pandas as pd @@ -89,7 +90,7 @@ def statique_create(self): data = self.statique_db[index] with self.rest("POST", "/statique/", json=data) as response: - if response.status_code == 200 and response.js["size"] == 0: + if response.status_code == HTTPStatus.OK and response.js["size"] == 0: response.failure("No Statique entry was created") self.counter["static"]["create"] += 1 @@ -110,7 +111,7 @@ def statique_bulk(self): def status_list(self): """Assess the /dynamique/status/ GET endpoint.""" with self.rest("GET", "/dynamique/status/") as response: - if response.status_code == 404: + if response.status_code == HTTPStatus.NOT_FOUND: response.success() @task @@ -118,7 +119,7 @@ def status_get(self): """Assess the /dynamique/status/{id_pdc_itinerance} GET endpoint.""" id_pdc_itinerance = "FRALLEGO002006P3" with self.rest("GET", f"/dynamique/status/{id_pdc_itinerance}") as response: - if response.status_code == 404: + if response.status_code == HTTPStatus.NOT_FOUND: response.success() @task @@ -128,7 +129,7 @@ def status_history(self): with self.rest( "GET", f"/dynamique/status/{id_pdc_itinerance}/history" ) as response: - if response.status_code == 404: + if response.status_code == HTTPStatus.NOT_FOUND: response.success() @task