29
29
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
30
31
31
32
- import os
33
-
34
32
import pytest
35
33
36
34
from elasticapm .conf .constants import TRANSACTION
42
40
pytestmark = pytest .mark .graphene
43
41
44
42
45
- class Query (graphene .ObjectType ):
46
- rand = graphene .String ()
47
-
48
-
49
43
class Success (graphene .ObjectType ):
50
- yeah = graphene .String ()
44
+ yeah = graphene .String (required = True )
51
45
52
46
53
47
class Error (graphene .ObjectType ):
@@ -88,7 +82,9 @@ def resolve_err(self, *args, **kwargs):
88
82
return Error (message = "oops" )
89
83
90
84
91
- @pytest .mark .skipif (not hasattr (graphql , "VERSION" ) or graphql .VERSION [0 ] >= 3 , reason = "Executor is reimplementated in graphql-core 3" )
85
+ @pytest .mark .skipif (
86
+ not hasattr (graphql , "VERSION" ) or graphql .VERSION [0 ] >= 3 , reason = "Executor is reimplementated in graphql-core 3"
87
+ )
92
88
@pytest .mark .integrationtest
93
89
def test_create_post (instrument , elasticapm_client ):
94
90
query_string = """
@@ -112,16 +108,17 @@ def test_create_post(instrument, elasticapm_client):
112
108
transactions = elasticapm_client .events [TRANSACTION ]
113
109
spans = elasticapm_client .spans_for_transaction (transactions [0 ])
114
110
expected_signatures = {
115
- "GraphQL.mutation __typename" ,
116
111
"GraphQL.mutation createPost" ,
117
112
"GraphQL.mutation result" ,
118
113
"test_graphene" ,
119
114
}
120
115
assert {t ["name" ] for t in spans } == expected_signatures
121
- assert transactions [0 ][' name' ] == ' GraphQL MUTATION createPost'
116
+ assert transactions [0 ][" name" ] == " GraphQL MUTATION createPost"
122
117
123
118
124
- @pytest .mark .skipif (not hasattr (graphql , "VERSION" ) or graphql .VERSION [0 ] >= 3 , reason = "Executor is reimplementated in graphql-core 3" )
119
+ @pytest .mark .skipif (
120
+ not hasattr (graphql , "VERSION" ) or graphql .VERSION [0 ] >= 3 , reason = "Executor is reimplementated in graphql-core 3"
121
+ )
125
122
@pytest .mark .integrationtest
126
123
def test_fetch_data (instrument , elasticapm_client ):
127
124
query_string = "{succ{yeah},err{__typename}}"
@@ -136,10 +133,9 @@ def test_fetch_data(instrument, elasticapm_client):
136
133
transactions = elasticapm_client .events [TRANSACTION ]
137
134
spans = elasticapm_client .spans_for_transaction (transactions [0 ])
138
135
expected_signatures = {
139
- "GraphQL.query __typename" ,
140
136
"GraphQL.query err" ,
141
137
"GraphQL.query succ" ,
142
138
"test_graphene" ,
143
139
}
144
140
assert {t ["name" ] for t in spans } == expected_signatures
145
- assert transactions [0 ][' name' ] == ' GraphQL QUERY succ+err'
141
+ assert transactions [0 ][" name" ] == " GraphQL QUERY succ+err"
0 commit comments