-
Notifications
You must be signed in to change notification settings - Fork 822
Make tests work with GraphQL-core 3.2.0rc2 #1378
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
This fix aligns to some changes in GraphQL-core 3.2 which reflect changes in GraphQL.js 16: - type resolvers must return only names - doesn't print trailing newlines any more - different wording of some error messages
a1c3d21
to
989970f
Compare
Closes #1406 ? Our CI caught another faulty import with 3.2 btw: https://github.com/graphql-python/graphene/pull/1415/files |
In addition to the remaining issue already referenced we see _________________________ test_node_query_incorrect_id _________________________
def test_node_query_incorrect_id():
executed = schema.execute(
'{ node(id:"%s") { ... on MyNode { name } } }' % "something:2"
)
assert executed.errors
> assert re.match(r"Unable to parse global ID .*", executed.errors[0].message)
E assert None
E + where None = <function match at 0x7ffff75181f0>('Unable to parse global ID .*', 'Relay Node "" not found in schema')
E + where <function match at 0x7ffff75181f0> = re.match
E + and 'Relay Node "" not found in schema' = GraphQLError('Relay Node "" not found in schema', locations=[SourceLocation(line=1, column=3)], path=['node']).message
graphene/relay/tests/test_node.py:109: AssertionError
___________________________ test_example_end_to_end ____________________________
def test_example_end_to_end():
class Movie(graphene.ObjectType):
class Meta:
interfaces = (relay.Node,)
default_resolver = dict_resolver
name = graphene.String(required=True)
synopsis = graphene.String(required=True)
class Event(graphene.ObjectType):
class Meta:
interfaces = (relay.Node,)
default_resolver = dict_resolver
movie = graphene.Field(Movie, required=True)
date = graphene.types.datetime.Date(required=True)
def resolve_movie(event, info):
return TEST_DATA["movies"][event["movie"]]
class Query(graphene.ObjectType):
events = graphene.List(graphene.NonNull(Event), required=True)
def resolve_events(_, info):
return TEST_DATA["events"]
schema = graphene.Schema(query=Query)
query = """\
{
events {
__typename
id
date
movie {
__typename
id
name
synopsis
}
}
}
"""
result = schema.execute(query)
> assert not result.errors
E AssertionError: assert not [GraphQLError('ID cannot represent value: None', locations=[SourceLocation(line=8, column=21)], path=['events', 0, 'movie', 'id'])]
E + where [GraphQLError('ID cannot represent value: None', locations=[SourceLocation(line=8, column=21)], path=['events', 0, 'movie', 'id'])] = ExecutionResult(data=None, errors=[GraphQLError('ID cannot represent value: None', locations=[SourceLocation(line=8, column=21)], path=['events', 0, 'movie', 'id'])]).errors
graphene/utils/tests/test_deduplicator.py:151: AssertionError |
I made a pull request built on top of this pull request, hopefully fixing the remaining issues: #1417 |
This can be closed with the 3.1.0 release. |
yes, superceded by #1421 |
@ddelange @SuperSandro2000 thank you for linking the other issue! |
This fix aligns to some changes in GraphQL-core 3.2 which reflect changes in GraphQL.js 16: