Add base tests for post

This commit is contained in:
Sebastiaan
2026-03-21 12:22:43 +01:00
parent 0a51e6559e
commit 0df8587f78
2 changed files with 225 additions and 0 deletions

View File

@@ -0,0 +1,12 @@
from sqlmodel import Session
from app.models.post import Post, PostCreate
from app.tests.utils.utils import random_lower_string
def create_random_post(db: Session, name: str = None) -> Post:
if not name:
name = random_lower_string()
post_in = PostCreate(name=name)
return Post.create(session=db, create_obj=post_in)