Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Jonathan Kim
committed
May 4, 2018
1 parent
05d7e61
commit 26932b2
Showing
1 changed file
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# https://github.com/graphql-python/graphene/issues/719 | ||
|
||
import graphene | ||
|
||
|
||
class InvitationType(graphene.ObjectType): | ||
creation_date = graphene.String() | ||
|
||
|
||
class CreateInvitation(graphene.Mutation): | ||
class Arguments: | ||
email = graphene.String(required=True) | ||
|
||
invitation = graphene.Field(InvitationType) | ||
|
||
def mutate(self, info, email): | ||
return InvitationType(creation_date='2018-05-04T14:45:36') | ||
|
||
|
||
class Mutations(graphene.ObjectType): | ||
create_invitation = CreateInvitation.Field() | ||
|
||
|
||
class Query(graphene.ObjectType): | ||
name = graphene.String(default_value="Dave") | ||
|
||
|
||
def test_issue(): | ||
query_string = ''' | ||
mutation ($email: String!) { | ||
createInvitation(email: $email) { | ||
invitation { | ||
creationDate | ||
} | ||
} | ||
} | ||
''' | ||
|
||
schema = graphene.Schema(query=Query, mutation=Mutations) | ||
result = schema.execute(query_string, variable_values={ | ||
'email': 'foo@bar.com', | ||
}) | ||
|
||
assert not result.errors | ||
# assert result.data['someField'] == 'Oh' |