Skip to content

Commit e5054e8

Browse files
author
matmoncon
committed
test: update schema test cases
1 parent 8889c62 commit e5054e8

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

tests/unit/test_schema.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
from pyneo4j_ogm.pydantic_utils import IS_PYDANTIC_V2, get_schema
44
from tests.fixtures.db_setup import Coffee, Consumed, Developer
5+
from tests.utils.string_utils import assert_string_equality
56

67

78
def test_schema():
@@ -14,6 +15,12 @@ def test_schema():
1415
if IS_PYDANTIC_V2:
1516
assert "coffee" in schema["properties"]
1617
assert "default" in schema["properties"]["coffee"]
18+
assert_string_equality(
19+
schema["properties"]["coffee"]["default"],
20+
"""RelationshipProperty(target_model_name=Coffee, relationship_model=Consumed,
21+
direction=OUTGOING, cardinality=ZERO_OR_MORE,
22+
allow_multiple=False)""",
23+
)
1724
assert schema["properties"]["coffee"]["type"] == "object"
1825
assert schema["properties"]["coffee"]["title"] == "Coffee"
1926
assert schema["properties"]["coffee"]["required"] == [
@@ -29,6 +36,12 @@ def test_schema():
2936

3037
assert "colleagues" in schema["properties"]
3138
assert "default" in schema["properties"]["colleagues"]
39+
assert_string_equality(
40+
schema["properties"]["colleagues"]["default"],
41+
"""RelationshipProperty(target_model_name=Developer, relationship_model=WorkedWith,
42+
direction=OUTGOING, cardinality=ZERO_OR_MORE,
43+
allow_multiple=True)""",
44+
)
3245
assert schema["properties"]["colleagues"]["type"] == "object"
3346
assert schema["properties"]["colleagues"]["title"] == "Colleagues"
3447
assert schema["properties"]["colleagues"]["required"] == [
@@ -44,6 +57,12 @@ def test_schema():
4457
else:
4558
assert "coffee" in schema["definitions"]["Developer"]["properties"]
4659
assert "default" in schema["definitions"]["Developer"]["properties"]["coffee"]
60+
assert_string_equality(
61+
schema["definitions"]["Developer"]["properties"]["coffee"]["default"],
62+
"""RelationshipProperty(target_model_name=Coffee, relationship_model=Consumed,
63+
direction=OUTGOING, cardinality=ZERO_OR_MORE,
64+
allow_multiple=False)""",
65+
)
4766
assert schema["definitions"]["Developer"]["properties"]["coffee"]["type"] == "object"
4867
assert schema["definitions"]["Developer"]["properties"]["coffee"]["title"] == "Coffee"
4968
assert schema["definitions"]["Developer"]["properties"]["coffee"]["required"] == [
@@ -70,6 +89,12 @@ def test_schema():
7089

7190
assert "colleagues" in schema["definitions"]["Developer"]["properties"]
7291
assert "default" in schema["definitions"]["Developer"]["properties"]["colleagues"]
92+
assert_string_equality(
93+
schema["definitions"]["Developer"]["properties"]["colleagues"]["default"],
94+
"""RelationshipProperty(target_model_name=Developer, relationship_model=WorkedWith,
95+
direction=OUTGOING, cardinality=ZERO_OR_MORE,
96+
allow_multiple=True)""",
97+
)
7398
assert schema["definitions"]["Developer"]["properties"]["colleagues"]["type"] == "object"
7499
assert schema["definitions"]["Developer"]["properties"]["colleagues"]["title"] == "Colleagues"
75100
assert schema["definitions"]["Developer"]["properties"]["colleagues"]["required"] == [

0 commit comments

Comments
 (0)