This commit is contained in:
parent
75085f240c
commit
eeb01bf6e8
@ -1,6 +1,6 @@
|
|||||||
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
# SPDX-FileCopyrightText: WTF Kooperative eG <https://wtf-eg.de/>
|
||||||
#
|
#
|
||||||
# SPDX-License-Identifier: AGPL-3.0-or-later
|
# SPDX-License-Identifier: AGPL-3.0-or-later
|
||||||
|
|
||||||
from alembic import command
|
from alembic import command
|
||||||
import json
|
import json
|
||||||
@ -10,7 +10,7 @@ from app import app, db, migrate
|
|||||||
from ki.actions import seed
|
from ki.actions import seed
|
||||||
from ki.models import Skill
|
from ki.models import Skill
|
||||||
|
|
||||||
from sqlalchemy import select
|
# from sqlalchemy import select
|
||||||
|
|
||||||
|
|
||||||
class ApiTest(unittest.TestCase):
|
class ApiTest(unittest.TestCase):
|
||||||
@ -31,24 +31,21 @@ class ApiTest(unittest.TestCase):
|
|||||||
command.upgrade(config, "head")
|
command.upgrade(config, "head")
|
||||||
seed(True)
|
seed(True)
|
||||||
|
|
||||||
#statement = select(Skill).order_by(Skill.id.desc())
|
# statement = select(Skill).order_by(Skill.id.desc())
|
||||||
#print(statement)
|
# print(statement)
|
||||||
#skill_obj = db.session.scalars(statement).all()
|
# skill_obj = db.session.scalars(statement).all()
|
||||||
#print(skill_obj)
|
# print(skill_obj)
|
||||||
#statement = select(Skill.id)
|
# statement = select(Skill.id)
|
||||||
#print(statement)
|
# print(statement)
|
||||||
|
# max_skill = db.session.Skill().order_by(Skill.id.desc()).first()
|
||||||
#max_skill = db.session.Skill().order_by(Skill.id.desc()).first()
|
# max_skill = Skill.query.order_by(Skill.id.desc()).first() # TODO: problematic
|
||||||
#max_skill = Skill.query.order_by(Skill.id.desc()).first() # TODO: problematic
|
with db.session.no_autoflush: # only works on first test run
|
||||||
|
max_skill = db.session.query(Skill).order_by(Skill.id.desc()).first() # TODO: also problematic,
|
||||||
with db.session.no_autoflush: # only works on first test run
|
# skills = db.session.execute(db.select(Skill)).scalars()
|
||||||
max_skill = db.session.query(Skill).order_by(Skill.id.desc()).first() # TODO: also problematic,
|
# print(max_skill)
|
||||||
|
# max_skill = db.session.execute(db.select(Skill)
|
||||||
#skills = db.session.execute(db.select(Skill)).scalars()
|
# .order_by(Skill.id.desc())
|
||||||
#print(max_skill)
|
# ).scalar_one()
|
||||||
#max_skill = db.session.execute(db.select(Skill)
|
|
||||||
## .order_by(Skill.id.desc())
|
|
||||||
# ).scalar_one()
|
|
||||||
print(max_skill)
|
print(max_skill)
|
||||||
print("max_skill done")
|
print("max_skill done")
|
||||||
self.max_skill_id = max_skill.id
|
self.max_skill_id = max_skill.id
|
||||||
@ -60,7 +57,7 @@ class ApiTest(unittest.TestCase):
|
|||||||
db.engine.dispose()
|
db.engine.dispose()
|
||||||
|
|
||||||
def login(self, username, password):
|
def login(self, username, password):
|
||||||
#with app.app_context():
|
# with app.app_context():
|
||||||
login_data = {"username": username, "password": password}
|
login_data = {"username": username, "password": password}
|
||||||
login_response = self.client.post("/users/login", data=json.dumps(login_data), content_type="application/json")
|
login_response = self.client.post("/users/login", data=json.dumps(login_data), content_type="application/json")
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user