Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
SCODOC_R6A06
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ilyes Lekehal De Percin
SCODOC_R6A06
Commits
e415a525
Commit
e415a525
authored
1 year ago
by
Emmanuel Viennet
Browse files
Options
Downloads
Patches
Plain Diff
Fix bug: evaluations sans dates
parent
dae04658
No related branches found
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
app/models/evaluations.py
+1
-1
1 addition, 1 deletion
app/models/evaluations.py
sco_version.py
+1
-1
1 addition, 1 deletion
sco_version.py
tests/api/setup_test_api.py
+26
-12
26 additions, 12 deletions
tests/api/setup_test_api.py
with
28 additions
and
14 deletions
app/models/evaluations.py
+
1
−
1
View file @
e415a525
...
@@ -184,7 +184,7 @@ class Evaluation(db.Model):
...
@@ -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 }
...
...
This diff is collapsed.
Click to expand it.
sco_version.py
+
1
−
1
View file @
e415a525
# -*- mode: python -*-
# -*- mode: python -*-
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
SCOVERSION
=
"
9.6.8
0
"
SCOVERSION
=
"
9.6.8
1
"
SCONAME
=
"
ScoDoc
"
SCONAME
=
"
ScoDoc
"
...
...
This diff is collapsed.
Click to expand it.
tests/api/setup_test_api.py
+
26
−
12
View file @
e415a525
...
@@ -15,8 +15,18 @@ Utilisation :
...
@@ -15,8 +15,18 @@ Utilisation :
"""
"""
import
os
import
os
import
requests
import
requests
from
dotenv
import
load_dotenv
import
pytest
try
:
from
dotenv
import
load_dotenv
except
ModuleNotFoundError
:
print
(
"
\n
Warning: dotenv not installed, ignoring .env
"
)
print
(
"
You may install it using:
\n
pip install python-dotenv
\n
"
)
load_dotenv
=
None
try
:
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:
...
@@ -24,9 +34,11 @@ try:
except
NameError
:
except
NameError
:
BASEDIR
=
"
/opt/scodoc/tests/api
"
BASEDIR
=
"
/opt/scodoc/tests/api
"
load_dotenv
(
os
.
path
.
join
(
BASEDIR
,
"
.env
"
))
if
load_dotenv
:
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"
...
@@ -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,16 +66,17 @@ def get_auth_headers(user, password) -> dict:
...
@@ -53,16 +66,17 @@ def get_auth_headers(user, password) -> dict:
return
{
"
Authorization
"
:
f
"
Bearer
{
token
}
"
}
return
{
"
Authorization
"
:
f
"
Bearer
{
token
}
"
}
@pytest.fixture
if
pytest
:
def
api_headers
()
->
dict
:
"""
Jeton, utilisateur API ordinaire
"""
return
get_auth_headers
(
API_USER
,
API_PASSWORD
)
@pytest.fixture
def
api_headers
()
->
dict
:
"""
Jeton, utilisateur API ordinaire
"""
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
"""
return
get_auth_headers
(
API_USER_ADMIN
,
API_PASSWORD_ADMIN
)
return
get_auth_headers
(
API_USER_ADMIN
,
API_PASSWORD_ADMIN
)
def
GET
(
path
:
str
,
headers
:
dict
=
None
,
errmsg
=
None
,
dept
=
None
):
def
GET
(
path
:
str
,
headers
:
dict
=
None
,
errmsg
=
None
,
dept
=
None
):
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment