forked from ScoDoc/ScoDoc
Fix bug: evaluations sans dates
This commit is contained in:
parent
dae04658b7
commit
e415a5255e
@ -184,7 +184,7 @@ class Evaluation(db.Model):
|
|||||||
# ScoDoc7 output_formators
|
# ScoDoc7 output_formators
|
||||||
e_dict["evaluation_id"] = self.id
|
e_dict["evaluation_id"] = self.id
|
||||||
e_dict["date_debut"] = self.date_debut.isoformat() if self.date_debut else None
|
e_dict["date_debut"] = self.date_debut.isoformat() if self.date_debut else None
|
||||||
e_dict["date_fin"] = self.date_debut.isoformat() if self.date_fin else None
|
e_dict["date_fin"] = self.date_fin.isoformat() if self.date_fin else None
|
||||||
e_dict["numero"] = self.numero or 0
|
e_dict["numero"] = self.numero or 0
|
||||||
e_dict["poids"] = self.get_ue_poids_dict() # { ue_id : poids }
|
e_dict["poids"] = self.get_ue_poids_dict() # { ue_id : poids }
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
# -*- mode: python -*-
|
# -*- mode: python -*-
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
SCOVERSION = "9.6.80"
|
SCOVERSION = "9.6.81"
|
||||||
|
|
||||||
SCONAME = "ScoDoc"
|
SCONAME = "ScoDoc"
|
||||||
|
|
||||||
|
@ -15,8 +15,18 @@ Utilisation :
|
|||||||
"""
|
"""
|
||||||
import os
|
import os
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
try:
|
||||||
from dotenv import load_dotenv
|
from dotenv import load_dotenv
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
print("\nWarning: dotenv not installed, ignoring .env")
|
||||||
|
print("You may install it using:\npip install python-dotenv\n")
|
||||||
|
load_dotenv = None
|
||||||
|
try:
|
||||||
import pytest
|
import pytest
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
print("pytest not installed\n")
|
||||||
|
pytest = None
|
||||||
|
|
||||||
# --- Lecture configuration (variables d'env ou .env)
|
# --- Lecture configuration (variables d'env ou .env)
|
||||||
try:
|
try:
|
||||||
@ -24,9 +34,11 @@ try:
|
|||||||
except NameError:
|
except NameError:
|
||||||
BASEDIR = "/opt/scodoc/tests/api"
|
BASEDIR = "/opt/scodoc/tests/api"
|
||||||
|
|
||||||
|
if load_dotenv:
|
||||||
load_dotenv(os.path.join(BASEDIR, ".env"))
|
load_dotenv(os.path.join(BASEDIR, ".env"))
|
||||||
|
|
||||||
CHECK_CERTIFICATE = bool(os.environ.get("CHECK_CERTIFICATE", False))
|
CHECK_CERTIFICATE = bool(os.environ.get("CHECK_CERTIFICATE", False))
|
||||||
SCODOC_URL = os.environ["SCODOC_URL"] or "http://localhost:5000"
|
SCODOC_URL = os.environ.get("SCODOC_URL") or "http://localhost:5000"
|
||||||
API_URL = SCODOC_URL + "/ScoDoc/api"
|
API_URL = SCODOC_URL + "/ScoDoc/api"
|
||||||
API_USER = os.environ.get("API_USER", "test")
|
API_USER = os.environ.get("API_USER", "test")
|
||||||
API_PASSWORD = os.environ.get("API_PASSWORD", os.environ.get("API_PASSWD", "test"))
|
API_PASSWORD = os.environ.get("API_PASSWORD", os.environ.get("API_PASSWD", "test"))
|
||||||
@ -36,6 +48,7 @@ DEPT_ACRONYM = "TAPI"
|
|||||||
SCO_TEST_API_TIMEOUT = 5
|
SCO_TEST_API_TIMEOUT = 5
|
||||||
print(f"SCODOC_URL={SCODOC_URL}")
|
print(f"SCODOC_URL={SCODOC_URL}")
|
||||||
print(f"API URL={API_URL}")
|
print(f"API URL={API_URL}")
|
||||||
|
print(f"API_USER={API_USER}")
|
||||||
|
|
||||||
|
|
||||||
class APIError(Exception):
|
class APIError(Exception):
|
||||||
@ -53,12 +66,13 @@ def get_auth_headers(user, password) -> dict:
|
|||||||
return {"Authorization": f"Bearer {token}"}
|
return {"Authorization": f"Bearer {token}"}
|
||||||
|
|
||||||
|
|
||||||
|
if pytest:
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def api_headers() -> dict:
|
def api_headers() -> dict:
|
||||||
"""Jeton, utilisateur API ordinaire"""
|
"""Jeton, utilisateur API ordinaire"""
|
||||||
return get_auth_headers(API_USER, API_PASSWORD)
|
return get_auth_headers(API_USER, API_PASSWORD)
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
def api_admin_headers() -> dict:
|
def api_admin_headers() -> dict:
|
||||||
"""Jeton, utilisateur API SuperAdmin"""
|
"""Jeton, utilisateur API SuperAdmin"""
|
||||||
|
Loading…
Reference in New Issue
Block a user