Skip to content

Commit 3e1b7fb

Browse files
author
Nicolas Maurice
committed
add test for type with custom options and custom field
1 parent 9206ec6 commit 3e1b7fb

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

graphene_sqlalchemy/tests/test_types.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,3 +153,28 @@ def test_objecttype_with_custom_options():
153153
'articles',
154154
'favorite_article']
155155
assert ReporterWithCustomOptions._meta.custom_option == 'custom_option'
156+
157+
158+
class ReporterWithCustomOptionsAndField(SQLAlchemyObjectTypeWithCustomOptions):
159+
class Meta:
160+
model = Reporter
161+
custom_option = 'custom_option'
162+
163+
custom_field = Field(Int())
164+
165+
166+
def test_objecttype_with_custom_options_and_field():
167+
assert issubclass(ReporterWithCustomOptions, ObjectType)
168+
assert ReporterWithCustomOptions._meta.model == Reporter
169+
assert list(
170+
ReporterWithCustomOptionsAndField._meta.fields.keys()) == [
171+
'id',
172+
'first_name',
173+
'last_name',
174+
'email',
175+
'pets',
176+
'articles',
177+
'favorite_article',
178+
'custom_field']
179+
assert ReporterWithCustomOptionsAndField._meta.custom_option == 'custom_option'
180+
assert isinstance(ReporterWithCustomOptionsAndField._meta.fields['custom_field'].type, Int)

0 commit comments

Comments
 (0)