Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion graphene/types/mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ def Field(
args=cls._meta.arguments,
resolver=cls._meta.resolver,
name=name,
description=description,
description=description or cls._meta.description,
deprecation_reason=deprecation_reason,
required=required,
)
24 changes: 24 additions & 0 deletions graphene/types/tests/test_mutation.py
Original file line number Diff line number Diff line change
Expand Up @@ -139,17 +139,41 @@ def mutate(self, info, name):

class MyMutation(ObjectType):
create_user = CreateUser.Field(
name="createUser",
description="Create a user",
deprecation_reason="Is deprecated",
required=True,
)

field = MyMutation._meta.fields["create_user"]
assert field.name == "createUser"
assert field.description == "Create a user"
assert field.deprecation_reason == "Is deprecated"
assert field.type == NonNull(CreateUser)


def test_mutation_default_args_output():
class CreateUser(Mutation):
"""Description."""

class Arguments:
name = String()

name = String()

def mutate(self, info, name):
return CreateUser(name=name)

class MyMutation(ObjectType):
create_user = CreateUser.Field()

field = MyMutation._meta.fields["create_user"]
assert field.name is None
assert field.description == "Description."
assert field.deprecation_reason is None
assert field.type == CreateUser


def test_mutation_as_subclass():
class BaseCreateUser(Mutation):
class Arguments:
Expand Down