Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jacquesfize committed Aug 8, 2024
1 parent 879b842 commit 3d84b58
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions backend/gn_module_import/tests/test_imports.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
from werkzeug.datastructures import Headers
from werkzeug.exceptions import Unauthorized, Forbidden, BadRequest, Conflict
from jsonschema import validate as validate_json
from sqlalchemy import func
from sqlalchemy import func, insert
from sqlalchemy.sql.expression import select

from apptax.taxonomie.models import BibListes, CorNomListe, BibNoms
from apptax.taxonomie.models import BibListes, cor_nom_liste, TaxRef
from geonature.utils.env import db
from geonature.core.gn_permissions.tools import (
get_scopes_by_action as _get_scopes_by_action,
Expand Down Expand Up @@ -282,16 +282,15 @@ def sample_taxhub_list():
cd_nom = 67111
with db.session.begin_nested():
id_list_not_exist = (db.session.query(func.max(BibListes.id_liste)).scalar() or 0) + 1
bibTaxon = db.session.query(BibNoms).filter(BibNoms.cd_nom == cd_nom).first()
if bibTaxon is None:
bibTaxon = BibNoms(cd_nom=cd_nom, cd_ref=cd_nom)
db.session.add(bibTaxon)
taxon = db.session.query(TaxRef).where(TaxRef.cd_nom == cd_nom).first()
taxa_list = BibListes(
id_liste=id_list_not_exist, nom_liste="test", code_liste="test", picto=""
)
db.session.add(taxa_list)
with db.session.begin_nested():
db.session.add(CorNomListe(id_nom=bibTaxon.id_nom, id_liste=taxa_list.id_liste))
db.session.execute(
insert(cor_nom_liste).values(cd_nom=cd_nom, id_liste=taxa_list.id_liste)
)
return taxa_list


Expand Down

0 comments on commit 3d84b58

Please sign in to comment.