test article (#104)

Co-authored-by: Igor Lobanov <igor.lobanov@onetwotrip.com>
This commit is contained in:
Ilya Y
2023-11-04 19:44:58 +03:00
committed by GitHub
parent 21316187e0
commit 0da4e110c1
3 changed files with 14 additions and 4 deletions

View File

@@ -1,3 +1,4 @@
import json
from datetime import datetime, timedelta, timezone
from sqlalchemy.orm import aliased, joinedload
@@ -79,6 +80,15 @@ def apply_filters(q, filters, user_id=None): # noqa: C901
@query.field("loadShout")
async def load_shout(_, info, slug=None, shout_id=None):
# for testing, soon will be removed
if slug == "testtesttest":
with open("test/test.json") as json_file:
test_shout = json.load(json_file)["data"]["loadShout"]
test_shout["createdAt"] = datetime.fromisoformat(test_shout["createdAt"])
test_shout["publishedAt"] = datetime.fromisoformat(test_shout["publishedAt"])
print(test_shout)
return test_shout
with local_session() as session:
q = select(Shout).options(
joinedload(Shout.authors),