Skip to content

Commit 8e53672

Browse files
committed
Add mutation field default arg test
1 parent 4d5a091 commit 8e53672

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

graphene/types/tests/test_mutation.py

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,17 +139,41 @@ def mutate(self, info, name):
139139

140140
class MyMutation(ObjectType):
141141
create_user = CreateUser.Field(
142+
name="createUser",
142143
description="Create a user",
143144
deprecation_reason="Is deprecated",
144145
required=True,
145146
)
146147

147148
field = MyMutation._meta.fields["create_user"]
149+
assert field.name == "createUser"
148150
assert field.description == "Create a user"
149151
assert field.deprecation_reason == "Is deprecated"
150152
assert field.type == NonNull(CreateUser)
151153

152154

155+
def test_mutation_default_args_output():
156+
class CreateUser(Mutation):
157+
"""Description."""
158+
159+
class Arguments:
160+
name = String()
161+
162+
name = String()
163+
164+
def mutate(self, info, name):
165+
return CreateUser(name=name)
166+
167+
class MyMutation(ObjectType):
168+
create_user = CreateUser.Field()
169+
170+
field = MyMutation._meta.fields["create_user"]
171+
assert field.name is None
172+
assert field.description == "Description."
173+
assert field.deprecation_reason is None
174+
assert field.type == CreateUser
175+
176+
153177
def test_mutation_as_subclass():
154178
class BaseCreateUser(Mutation):
155179
class Arguments:

0 commit comments

Comments
 (0)