mirror of
https://github.com/graphql-python/graphene.git
synced 2024-11-11 04:07:16 +03:00
Added tests for global id.
This commit is contained in:
parent
5f7af3e43f
commit
0a79df3d13
22
graphene/relay/tests/test_global_id.py
Normal file
22
graphene/relay/tests/test_global_id.py
Normal file
|
@ -0,0 +1,22 @@
|
||||||
|
from ..node import Node, GlobalID
|
||||||
|
|
||||||
|
from ...types import NonNull, ID
|
||||||
|
|
||||||
|
|
||||||
|
class CustomNode(Node):
|
||||||
|
|
||||||
|
class Meta:
|
||||||
|
name = 'Node'
|
||||||
|
|
||||||
|
|
||||||
|
def test_global_id_defaults_to_required_and_node():
|
||||||
|
gid = GlobalID()
|
||||||
|
assert isinstance(gid.type, NonNull)
|
||||||
|
assert gid.type.of_type == ID
|
||||||
|
assert gid.node == Node
|
||||||
|
|
||||||
|
|
||||||
|
def test_global_id_allows_overriding_of_node_and_required():
|
||||||
|
gid = GlobalID(node=CustomNode, required=False)
|
||||||
|
assert gid.type == ID
|
||||||
|
assert gid.node == CustomNode
|
Loading…
Reference in New Issue
Block a user