File tree Expand file tree Collapse file tree 1 file changed +34
-0
lines changed
backend/app/tests/crud/documents Expand file tree Collapse file tree 1 file changed +34
-0
lines changed Original file line number Diff line number Diff line change 1+ import pytest
2+ from sqlmodel import Session , select
3+
4+ from app .crud import DocumentCrud
5+ from app .models import Document
6+
7+ from _utils import (
8+ insert_document ,
9+ rm_documents ,
10+ )
11+
12+ @pytest .fixture
13+ def document (db : Session ):
14+ rm_documents (db )
15+ document = insert_document (db )
16+
17+ crud = DocumentCrud (db )
18+ crud .delete (document .id , document .owner_id )
19+
20+ statement = (
21+ select (Document )
22+ .where (Document .id == document .id )
23+ )
24+ return db .exec (statement ).one ()
25+
26+ class TestDatabaseUpdate :
27+ def test_delete_is_soft (self , document : Document ):
28+ assert document is not None
29+
30+ def test_delete_marks_deleted (self , document : Document ):
31+ assert document .deleted_at is not None
32+
33+ def test_delete_follows_insert (self , document : Document ):
34+ assert document .created_at <= document .deleted_at
You can’t perform that action at this time.
0 commit comments