Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Link validation #714

Merged
merged 5 commits into from
Oct 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
reorganized tests
  • Loading branch information
iterlace committed Sep 18, 2023
commit 18c448fba9c254d9ae4601438a29992b056cadde
13 changes: 12 additions & 1 deletion tests/odm/documents/test_validation_on_save.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
import pytest
from pydantic import ValidationError

from tests.odm.models import DocumentWithValidationOnSave
from tests.odm.models import (
Lock,
DocumentWithValidationOnSave,
WindowWithValidationOnSave,
)


async def test_validate_on_insert():
Expand Down Expand Up @@ -37,3 +41,10 @@ async def test_validate_on_save_skip_action():
doc = DocumentWithValidationOnSave(num_1=1, num_2=2)
await doc.insert(skip_actions=["num_2_plus_1"])
assert doc.num_2 == 2


async def test_validate_on_save_dbref():
lock = Lock(k=1)
await lock.insert()
window = WindowWithValidationOnSave(x=1, y=1, lock=lock.to_ref())
await window.insert()
8 changes: 0 additions & 8 deletions tests/odm/test_relations.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@
Lock,
Roof,
Window,
WindowWithValidationOnSave,
Yard,
RootDocument,
ADocument,
Expand Down Expand Up @@ -656,13 +655,6 @@ async def test_write_list(self, list_link_and_list_backlink_doc_pair):
assert lnk.s == "new value"


async def test_validate_on_save_dbref():
lock = Lock(k=1)
await lock.insert()
window = WindowWithValidationOnSave(x=1, y=1, lock=lock.to_ref())
await window.insert()


class HouseForReversedOrderInit(Document):
name: str
door: Link["DoorForReversedOrderInit"]
Expand Down