mirror of
https://github.com/graphql-python/graphene-django.git
synced 2025-07-13 09:42:32 +03:00
Update tests
This commit is contained in:
parent
022748cc0f
commit
084aa0120f
|
@ -774,7 +774,7 @@ def test_integer_field_filter_type():
|
||||||
model = Pet
|
model = Pet
|
||||||
interfaces = (Node,)
|
interfaces = (Node,)
|
||||||
filter_fields = {"age": ["exact"]}
|
filter_fields = {"age": ["exact"]}
|
||||||
only_fields = ["age"]
|
fields = ("age",)
|
||||||
|
|
||||||
class Query(ObjectType):
|
class Query(ObjectType):
|
||||||
pets = DjangoFilterConnectionField(PetType)
|
pets = DjangoFilterConnectionField(PetType)
|
||||||
|
|
|
@ -28,7 +28,7 @@ def test_should_query_only_fields():
|
||||||
class ReporterType(DjangoObjectType):
|
class ReporterType(DjangoObjectType):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Reporter
|
model = Reporter
|
||||||
only_fields = ("articles",)
|
fields = ("articles",)
|
||||||
|
|
||||||
schema = graphene.Schema(query=ReporterType)
|
schema = graphene.Schema(query=ReporterType)
|
||||||
query = """
|
query = """
|
||||||
|
@ -44,7 +44,7 @@ def test_should_query_simplelazy_objects():
|
||||||
class ReporterType(DjangoObjectType):
|
class ReporterType(DjangoObjectType):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Reporter
|
model = Reporter
|
||||||
only_fields = ("id",)
|
fields = ("id",)
|
||||||
|
|
||||||
class Query(graphene.ObjectType):
|
class Query(graphene.ObjectType):
|
||||||
reporter = graphene.Field(ReporterType)
|
reporter = graphene.Field(ReporterType)
|
||||||
|
@ -289,7 +289,7 @@ def test_should_query_connectionfields():
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Reporter
|
model = Reporter
|
||||||
interfaces = (Node,)
|
interfaces = (Node,)
|
||||||
only_fields = ("articles",)
|
fields = ("articles",)
|
||||||
|
|
||||||
class Query(graphene.ObjectType):
|
class Query(graphene.ObjectType):
|
||||||
all_reporters = DjangoConnectionField(ReporterType)
|
all_reporters = DjangoConnectionField(ReporterType)
|
||||||
|
@ -329,7 +329,7 @@ def test_should_keep_annotations():
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Reporter
|
model = Reporter
|
||||||
interfaces = (Node,)
|
interfaces = (Node,)
|
||||||
only_fields = ("articles",)
|
fields = ("articles",)
|
||||||
|
|
||||||
class ArticleType(DjangoObjectType):
|
class ArticleType(DjangoObjectType):
|
||||||
class Meta:
|
class Meta:
|
||||||
|
|
|
@ -48,6 +48,6 @@ def test_should_map_only_few_fields():
|
||||||
class Reporter2(DjangoObjectType):
|
class Reporter2(DjangoObjectType):
|
||||||
class Meta:
|
class Meta:
|
||||||
model = Reporter
|
model = Reporter
|
||||||
only_fields = ("id", "email")
|
fields = ("id", "email")
|
||||||
|
|
||||||
assert list(Reporter2._meta.fields.keys()) == ["id", "email"]
|
assert list(Reporter2._meta.fields.keys()) == ["id", "email"]
|
||||||
|
|
|
@ -211,10 +211,12 @@ def with_local_registry(func):
|
||||||
|
|
||||||
@with_local_registry
|
@with_local_registry
|
||||||
def test_django_objecttype_only_fields():
|
def test_django_objecttype_only_fields():
|
||||||
class Reporter(DjangoObjectType):
|
with pytest.warns(PendingDeprecationWarning):
|
||||||
class Meta:
|
|
||||||
model = ReporterModel
|
class Reporter(DjangoObjectType):
|
||||||
only_fields = ("id", "email", "films")
|
class Meta:
|
||||||
|
model = ReporterModel
|
||||||
|
only_fields = ("id", "email", "films")
|
||||||
|
|
||||||
fields = list(Reporter._meta.fields.keys())
|
fields = list(Reporter._meta.fields.keys())
|
||||||
assert fields == ["id", "email", "films"]
|
assert fields == ["id", "email", "films"]
|
||||||
|
@ -255,10 +257,12 @@ def test_django_objecttype_all_fields():
|
||||||
|
|
||||||
@with_local_registry
|
@with_local_registry
|
||||||
def test_django_objecttype_exclude_fields():
|
def test_django_objecttype_exclude_fields():
|
||||||
class Reporter(DjangoObjectType):
|
with pytest.warns(PendingDeprecationWarning):
|
||||||
class Meta:
|
|
||||||
model = ReporterModel
|
class Reporter(DjangoObjectType):
|
||||||
exclude_fields = ["email"]
|
class Meta:
|
||||||
|
model = ReporterModel
|
||||||
|
exclude_fields = ["email"]
|
||||||
|
|
||||||
fields = list(Reporter._meta.fields.keys())
|
fields = list(Reporter._meta.fields.keys())
|
||||||
assert "email" not in fields
|
assert "email" not in fields
|
||||||
|
|
Loading…
Reference in New Issue
Block a user