Skip to content

Commit 42c96a4

Browse files
committed
Added failing test
1 parent 0971a05 commit 42c96a4

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

graphene/relay/tests/test_connection.py

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import pytest
22

3-
from ...types import Argument, Field, Int, List, NonNull, ObjectType, String
3+
from ...types import Argument, Field, Int, List, NonNull, ObjectType, String, Schema
44
from ..connection import Connection, ConnectionField, PageInfo
55
from ..node import Node
66

@@ -155,3 +155,23 @@ class Meta:
155155
'last': Argument(Int),
156156
'extra': Argument(String),
157157
}
158+
159+
160+
def test_connectionfield_required():
161+
class MyObjectConnection(Connection):
162+
163+
class Meta:
164+
node = MyObject
165+
166+
class Query(ObjectType):
167+
test_connection = ConnectionField(MyObjectConnection, required=True)
168+
169+
def resolve_test_connection(root, info, **args):
170+
return []
171+
172+
schema = Schema(query=Query)
173+
executed = schema.execute(
174+
'{ testConnection { edges { cursor } } }'
175+
)
176+
assert not executed.errors
177+
assert executed.data == {'testConnection': {'edges': []}}

0 commit comments

Comments
 (0)