File tree 2 files changed +11
-3
lines changed
2 files changed +11
-3
lines changed Original file line number Diff line number Diff line change 4
4
from pytest import raises
5
5
6
6
from graphql .error import GraphQLError
7
- from graphql .execution import MiddlewareManager , execute
7
+ from graphql .execution import execute
8
+ from graphql .language .ast import ObjectTypeDefinition
8
9
from graphql .language .parser import parse
9
10
from graphql .type import (
10
11
GraphQLArgument ,
@@ -553,11 +554,18 @@ def test_fails_to_execute_a_query_containing_a_type_definition():
553
554
with raises (GraphQLError ) as excinfo :
554
555
execute (schema , query )
555
556
557
+ error = excinfo .value
558
+
556
559
assert (
557
- excinfo . value .message
560
+ error .message
558
561
== "GraphQL cannot execute a request containing a ObjectTypeDefinition."
559
562
)
560
563
564
+ nodes = error .nodes
565
+ assert type (nodes ) is list
566
+ assert len (nodes ) == 1
567
+ assert isinstance (nodes [0 ], ObjectTypeDefinition )
568
+
561
569
562
570
def test_exceptions_are_reraised_if_specified (mocker ):
563
571
# type: (MockFixture) -> None
Original file line number Diff line number Diff line change @@ -98,7 +98,7 @@ def __init__(
98
98
u"GraphQL cannot execute a request containing a {}." .format (
99
99
definition .__class__ .__name__
100
100
),
101
- definition ,
101
+ [ definition ] ,
102
102
)
103
103
104
104
if not operation :
You can’t perform that action at this time.
0 commit comments