@@ -22,7 +22,6 @@ class Query(graphene.ObjectType):
22
22
reporter = graphene .Field (nodes .ReporterNode )
23
23
24
24
def resolve_reporter (self , * args , ** kwargs ):
25
- print ('abc' * 10 )
26
25
return models .Reporter .objects .first ()
27
26
28
27
query = '''
@@ -120,7 +119,7 @@ def resolve_reporter(self, *args, **kwargs):
120
119
schema = graphene .Schema (query = Query )
121
120
result = schema .execute (query )
122
121
assert not result .errors
123
- assert result .data [ 'reporter' ] == expected [ 'reporter' ]
122
+ assert result .data == expected
124
123
125
124
126
125
def test_should_query_reporters_with_nested_document (fixtures ):
@@ -174,7 +173,7 @@ class Query(graphene.ObjectType):
174
173
schema = graphene .Schema (query = Query )
175
174
result = schema .execute (query )
176
175
assert not result .errors
177
- assert result .data [ 'reporters' ] == expected [ 'reporters' ]
176
+ assert result .data == expected
178
177
179
178
180
179
def test_should_query_all_editors (fixtures , fixtures_dirname ):
@@ -251,10 +250,10 @@ class Query(graphene.ObjectType):
251
250
schema = graphene .Schema (query = Query )
252
251
result = schema .execute (query )
253
252
assert not result .errors
254
- assert result .data ['editors' ] == expected ['editors' ]
255
-
253
+ assert result .data == expected
256
254
257
255
256
+ """
258
257
def test_should_query_editors_with_dataloader(fixtures):
259
258
from promise import Promise
260
259
from promise.dataloader import DataLoader
@@ -274,13 +273,13 @@ def batch_load_fn(self, keys):
274
273
editor_loader = EditorLoader()
275
274
276
275
class Query(graphene.ObjectType):
277
- editors = MongoengineConnectionField (nodes .EditorNode )
276
+ # editors = MongoengineConnectionField(nodes.EditorNode)
277
+ editors = graphene.List(types.EditorType)
278
278
279
- """
280
279
def resolve_editors(self, info, **args):
281
280
print(self.__dict__)
282
281
return None
283
- """
282
+
284
283
285
284
query = '''
286
285
query EditorPromiseQuery {
@@ -299,17 +298,17 @@ def resolve_editors(self, info, **args):
299
298
schema = graphene.Schema(query=Query)
300
299
result = schema.execute(query)
301
300
print(result.data)
301
+ """
302
302
303
303
304
304
def test_should_filter_editors_by_id (fixtures ):
305
305
306
306
class Query (graphene .ObjectType ):
307
- node = Node .Field ()
308
- all_editors = MongoengineConnectionField (nodes .EditorNode )
307
+ editors = MongoengineConnectionField (nodes .EditorNode )
309
308
310
309
query = '''
311
310
query EditorQuery {
312
- allEditors (id: "RWRpdG9yTm9kZToy") {
311
+ editors (id: "RWRpdG9yTm9kZToy") {
313
312
edges {
314
313
node {
315
314
id,
@@ -321,7 +320,7 @@ class Query(graphene.ObjectType):
321
320
}
322
321
'''
323
322
expected = {
324
- 'allEditors ' : {
323
+ 'editors ' : {
325
324
'edges' : [
326
325
{
327
326
'node' : {
@@ -337,13 +336,12 @@ class Query(graphene.ObjectType):
337
336
schema = graphene .Schema (query = Query )
338
337
result = schema .execute (query )
339
338
assert not result .errors
340
- assert dict ( result .data [ 'allEditors' ]) == expected [ 'allEditors' ]
339
+ assert result .data == expected
341
340
342
341
343
342
def test_should_filter (fixtures ):
344
343
345
344
class Query (graphene .ObjectType ):
346
- node = Node .Field ()
347
345
articles = MongoengineConnectionField (nodes .ArticleNode )
348
346
349
347
query = '''
@@ -385,7 +383,6 @@ class Query(graphene.ObjectType):
385
383
def test_should_filter_by_reference_field (fixtures ):
386
384
387
385
class Query (graphene .ObjectType ):
388
- node = Node .Field ()
389
386
articles = MongoengineConnectionField (nodes .ArticleNode )
390
387
391
388
query = '''
0 commit comments