Skip to content

Commit 65e1373

Browse files
committed
added promise test for connection resolver
1 parent 164fd72 commit 65e1373

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

graphene_sqlalchemy/tests/test_types.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,13 @@
11
from collections import OrderedDict
22
from graphene import Field, Int, Interface, ObjectType
3-
from graphene.relay import Node, is_node
3+
from graphene.relay import Node, is_node, Connection
44
import six
5+
from promise import Promise
56

67
from ..registry import Registry
78
from ..types import SQLAlchemyObjectType, SQLAlchemyObjectTypeOptions
89
from .models import Article, Reporter
10+
from ..fields import SQLAlchemyConnectionField
911

1012
registry = Registry()
1113

@@ -158,3 +160,13 @@ def test_objecttype_with_custom_options():
158160
'favorite_article']
159161
assert ReporterWithCustomOptions._meta.custom_option == 'custom_option'
160162
assert isinstance(ReporterWithCustomOptions._meta.fields['custom_field'].type, Int)
163+
164+
165+
def test_promise_connection_resolver():
166+
class TestConnection(Connection):
167+
class Meta:
168+
node = ReporterWithCustomOptions
169+
170+
resolver = lambda *args, **kwargs: Promise.resolve([])
171+
result = SQLAlchemyConnectionField.connection_resolver(resolver, TestConnection, ReporterWithCustomOptions, None, None)
172+
assert result is not None

0 commit comments

Comments
 (0)