Skip to content

Commit

Permalink
Rename get_resolver -> wrap_resolve and fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jkimbo committed Aug 6, 2020
1 parent 62f95f2 commit da9f41c
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 6 deletions.
4 changes: 2 additions & 2 deletions graphene_django/fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ def list_resolver(

return queryset

def get_resolver(self, parent_resolver):
def wrap_resolve(self, parent_resolver):
_type = self.type
if isinstance(_type, NonNull):
_type = _type.of_type
Expand Down Expand Up @@ -217,7 +217,7 @@ def connection_resolver(

return on_resolve(iterable)

def get_resolver(self, parent_resolver):
def wrap_resolve(self, parent_resolver):
return partial(
self.connection_resolver,
parent_resolver,
Expand Down
4 changes: 4 additions & 0 deletions graphene_django/filter/tests/test_fields.py
Original file line number Diff line number Diff line change
Expand Up @@ -417,12 +417,14 @@ class ReporterFilterNode(DjangoObjectType):
class Meta:
model = Reporter
interfaces = (Node,)
fields = "__all__"
filter_fields = ["first_name", "articles"]

class ArticleFilterNode(DjangoObjectType):
class Meta:
model = Article
interfaces = (Node,)
fields = "__all__"
filter_fields = ["headline", "reporter"]

class Query(ObjectType):
Expand Down Expand Up @@ -472,12 +474,14 @@ class ReporterFilterNode(DjangoObjectType):
class Meta:
model = Reporter
interfaces = (Node,)
fields = "__all__"
filter_fields = ["first_name", "articles"]

class ArticleFilterNode(DjangoObjectType):
class Meta:
model = Article
interfaces = (Node,)
fields = "__all__"
filter_fields = ["headline", "reporter"]

class Query(ObjectType):
Expand Down
3 changes: 3 additions & 0 deletions graphene_django/tests/test_query.py
Original file line number Diff line number Diff line change
Expand Up @@ -1122,6 +1122,7 @@ class ReporterType(DjangoObjectType):
class Meta:
model = Reporter
interfaces = (Node,)
fields = "__all__"

class Query(graphene.ObjectType):
all_reporters = DjangoConnectionField(ReporterType)
Expand Down Expand Up @@ -1166,6 +1167,7 @@ class ReporterType(DjangoObjectType):
class Meta:
model = Reporter
interfaces = (Node,)
fields = "__all__"

class Query(graphene.ObjectType):
all_reporters = DjangoConnectionField(ReporterType)
Expand Down Expand Up @@ -1198,6 +1200,7 @@ class ReporterType(DjangoObjectType):
class Meta:
model = Reporter
interfaces = (Node,)
fields = "__all__"

class Query(graphene.ObjectType):
all_reporters = DjangoConnectionField(ReporterType)
Expand Down
6 changes: 3 additions & 3 deletions graphene_django/tests/test_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def test_camelize():

@pytest.mark.django_db
@patch("graphene_django.utils.testing.Client.post")
def test_graphql_test_case_op_name(post_mock):
def test_graphql_test_case_operation_name(post_mock):
"""
Test that `GraphQLTestCase.query()`'s `operation_name` argument produces an `operationName` field.
"""
Expand All @@ -63,8 +63,8 @@ def runTest(self):

@pytest.mark.django_db
@patch("graphene_django.utils.testing.Client.post")
def test_graphql_query_case_op_name(post_mock):
graphql_query("query { }", op_name="QueryName")
def test_graphql_query_case_operation_name(post_mock):
graphql_query("query { }", operation_name="QueryName")
body = json.loads(post_mock.call_args.args[1])
# `operationName` field from https://graphql.org/learn/serving-over-http/#post-request
assert (
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@
keywords="api graphql protocol rest relay graphene",
packages=find_packages(exclude=["tests"]),
install_requires=[
"graphene>=3.0.0b1,<4",
"graphene>=3.0.0b5,<4",
"graphql-core>=3.1.0,<4",
"Django>=2.2",
"promise>=2.1",
Expand Down

0 comments on commit da9f41c

Please sign in to comment.