Skip to content

Commit 97d6713

Browse files
Add function to create a random item for a user
1 parent ee0d597 commit 97d6713

1 file changed

Lines changed: 10 additions & 0 deletions

File tree

backend/tests/utils/item.py

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
import uuid
2+
13
from sqlmodel import Session
24

35
from app import crud
@@ -14,3 +16,11 @@ def create_random_item(db: Session) -> Item:
1416
description = random_lower_string()
1517
item_in = ItemCreate(title=title, description=description)
1618
return crud.create_item(session=db, item_in=item_in, owner_id=owner_id)
19+
20+
21+
def create_random_item_for_user(db: Session, owner_id: uuid.UUID) -> Item:
22+
assert owner_id is not None
23+
title = random_lower_string()
24+
description = random_lower_string()
25+
item_in = ItemCreate(title=title, description=description)
26+
return crud.create_item(session=db, item_in=item_in, owner_id=owner_id)

0 commit comments

Comments
 (0)