Update tests

This commit is contained in:
Jonathan Kim 2019-07-09 13:48:07 +01:00
parent 022748cc0f
commit 084aa0120f
4 changed files with 18 additions and 14 deletions

View File

@ -774,7 +774,7 @@ def test_integer_field_filter_type():
model = Pet
interfaces = (Node,)
filter_fields = {"age": ["exact"]}
only_fields = ["age"]
fields = ("age",)
class Query(ObjectType):
pets = DjangoFilterConnectionField(PetType)

View File

@ -28,7 +28,7 @@ def test_should_query_only_fields():
class ReporterType(DjangoObjectType):
class Meta:
model = Reporter
only_fields = ("articles",)
fields = ("articles",)
schema = graphene.Schema(query=ReporterType)
query = """
@ -44,7 +44,7 @@ def test_should_query_simplelazy_objects():
class ReporterType(DjangoObjectType):
class Meta:
model = Reporter
only_fields = ("id",)
fields = ("id",)
class Query(graphene.ObjectType):
reporter = graphene.Field(ReporterType)
@ -289,7 +289,7 @@ def test_should_query_connectionfields():
class Meta:
model = Reporter
interfaces = (Node,)
only_fields = ("articles",)
fields = ("articles",)
class Query(graphene.ObjectType):
all_reporters = DjangoConnectionField(ReporterType)
@ -329,7 +329,7 @@ def test_should_keep_annotations():
class Meta:
model = Reporter
interfaces = (Node,)
only_fields = ("articles",)
fields = ("articles",)
class ArticleType(DjangoObjectType):
class Meta:

View File

@ -48,6 +48,6 @@ def test_should_map_only_few_fields():
class Reporter2(DjangoObjectType):
class Meta:
model = Reporter
only_fields = ("id", "email")
fields = ("id", "email")
assert list(Reporter2._meta.fields.keys()) == ["id", "email"]

View File

@ -211,10 +211,12 @@ def with_local_registry(func):
@with_local_registry
def test_django_objecttype_only_fields():
class Reporter(DjangoObjectType):
class Meta:
model = ReporterModel
only_fields = ("id", "email", "films")
with pytest.warns(PendingDeprecationWarning):
class Reporter(DjangoObjectType):
class Meta:
model = ReporterModel
only_fields = ("id", "email", "films")
fields = list(Reporter._meta.fields.keys())
assert fields == ["id", "email", "films"]
@ -255,10 +257,12 @@ def test_django_objecttype_all_fields():
@with_local_registry
def test_django_objecttype_exclude_fields():
class Reporter(DjangoObjectType):
class Meta:
model = ReporterModel
exclude_fields = ["email"]
with pytest.warns(PendingDeprecationWarning):
class Reporter(DjangoObjectType):
class Meta:
model = ReporterModel
exclude_fields = ["email"]
fields = list(Reporter._meta.fields.keys())
assert "email" not in fields