Update test to a more real case scenario

This commit is contained in:
Sebastian Hernandez 2021-02-23 19:31:16 +01:00
parent aed2f78bdb
commit 8fbadee60c

View File

@ -1590,21 +1590,22 @@ def test_connection_should_allow_offset_filtering_with_after():
def test_should_query_django_objecttype_fields_custom_meta(): def test_should_query_django_objecttype_fields_custom_meta():
class ArticleTypeOptions(DjangoObjectTypeOptions):
"""Article Type Options with extra fields"""
fields = yank_fields_from_attrs(
{"headline_with_lang": graphene.String()}, _as=graphene.Field,
)
class ArticleBaseType(DjangoObjectType): class ArticleBaseType(DjangoObjectType):
class Meta: class Meta:
abstract = True abstract = True
@classmethod @classmethod
def __init_subclass_with_meta__(cls, **options): def __init_subclass_with_meta__(cls, _meta=None, **options):
options.setdefault("_meta", ArticleTypeOptions(cls)) if _meta is None:
super(ArticleBaseType, cls).__init_subclass_with_meta__(**options) _meta = DjangoObjectTypeOptions(cls)
_meta.fields = yank_fields_from_attrs(
{"headline_with_lang": graphene.String()}, _as=graphene.Field,
)
super(ArticleBaseType, cls).__init_subclass_with_meta__(
_meta=_meta, **options
)
class ArticleCustomType(ArticleBaseType): class ArticleCustomType(ArticleBaseType):
class Meta: class Meta: