Skip to content

Commit 12132a9

Browse files
committed
Add a test to reproduce issue described in #234
1 parent c89cf80 commit 12132a9

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

graphene_sqlalchemy/tests/test_types.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,3 +414,20 @@ class Meta:
414414
def test_deprecated_createConnectionField():
415415
with pytest.warns(DeprecationWarning):
416416
createConnectionField(None)
417+
418+
419+
def test_default_resolvers(session):
420+
class ReporterType(SQLAlchemyObjectType):
421+
class Meta:
422+
model = Reporter
423+
interfaces = (Node,)
424+
425+
def resolve_first_name(self):
426+
return self.first_name.upper()
427+
428+
reporter = Reporter(first_name='alice')
429+
session.add(reporter)
430+
session.commit()
431+
info = mock.Mock(context={'session': session})
432+
first_name = ReporterType._meta.fields['first_name']
433+
assert first_name.resolver(reporter, info) == 'ALICE'

0 commit comments

Comments
 (0)