Skip to content

Commit 0a79df3

Browse files
author
markus
committed
Added tests for global id.
1 parent 5f7af3e commit 0a79df3

File tree

1 file changed

+22
-0
lines changed

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
from ..node import Node, GlobalID
2+
3+
from ...types import NonNull, ID
4+
5+
6+
class CustomNode(Node):
7+
8+
class Meta:
9+
name = 'Node'
10+
11+
12+
def test_global_id_defaults_to_required_and_node():
13+
gid = GlobalID()
14+
assert isinstance(gid.type, NonNull)
15+
assert gid.type.of_type == ID
16+
assert gid.node == Node
17+
18+
19+
def test_global_id_allows_overriding_of_node_and_required():
20+
gid = GlobalID(node=CustomNode, required=False)
21+
assert gid.type == ID
22+
assert gid.node == CustomNode

0 commit comments

Comments
 (0)