1313 ChildNode ,)
1414from ..fields import MongoengineConnectionField
1515
16- setup_fixtures ()
17-
1816
1917def get_nodes (data , key ):
2018 return map (lambda edge : edge ['node' ], data [key ]['edges' ])
2119
2220
23- def test_should_query_reporter ():
21+ def test_should_query_reporter (setup_fixtures ):
2422
2523 class Query (graphene .ObjectType ):
2624 node = Node .Field ()
@@ -115,7 +113,7 @@ def resolve_reporter(self, *args, **kwargs):
115113 assert dict (result .data ['reporter' ]) == expected ['reporter' ]
116114
117115
118- def test_should_query_all_editors ():
116+ def test_should_query_all_editors (setup_fixtures ):
119117
120118 class Query (graphene .ObjectType ):
121119 node = Node .Field ()
@@ -168,7 +166,7 @@ class Query(graphene.ObjectType):
168166 assert dict (result .data ['allEditors' ]) == expected ['allEditors' ]
169167
170168
171- def test_should_filter_editors_by_id ():
169+ def test_should_filter_editors_by_id (setup_fixtures ):
172170
173171 class Query (graphene .ObjectType ):
174172 node = Node .Field ()
@@ -207,57 +205,7 @@ class Query(graphene.ObjectType):
207205 assert dict (result .data ['allEditors' ]) == expected ['allEditors' ]
208206
209207
210- def test_should_mutate ():
211-
212- class CreateArticle (graphene .Mutation ):
213-
214- class Arguments :
215-
216- headline = graphene .String ()
217-
218- article = graphene .Field (ArticleNode )
219-
220- def mutate (self , info , headline ):
221- article = Article (
222- headline = headline
223- )
224- article .save ()
225-
226- return CreateArticle (article = article )
227-
228- class Query (graphene .ObjectType ):
229-
230- node = Node .Field ()
231-
232- class Mutation (graphene .ObjectType ):
233-
234- create_article = CreateArticle .Field ()
235-
236- query = '''
237- mutation ArticleCreator {
238- createArticle(
239- headline: "My Article"
240- ) {
241- article {
242- headline
243- }
244- }
245- }
246- '''
247- expected = {
248- 'createArticle' : {
249- 'article' : {
250- 'headline' : 'My Article'
251- }
252- }
253- }
254- schema = graphene .Schema (query = Query , mutation = Mutation )
255- result = schema .execute (query )
256- assert not result .errors
257- assert result .data == expected
258-
259-
260- def test_should_filter ():
208+ def test_should_filter (setup_fixtures ):
261209
262210 class Query (graphene .ObjectType ):
263211 node = Node .Field ()
@@ -297,7 +245,7 @@ class Query(graphene.ObjectType):
297245 assert result .data == expected
298246
299247
300- def test_should_filter_by_reference_field ():
248+ def test_should_filter_by_reference_field (setup_fixtures ):
301249
302250 class Query (graphene .ObjectType ):
303251 node = Node .Field ()
@@ -337,7 +285,7 @@ class Query(graphene.ObjectType):
337285 assert result .data == expected
338286
339287
340- def test_should_filter_through_inheritance ():
288+ def test_should_filter_through_inheritance (setup_fixtures ):
341289
342290 class Query (graphene .ObjectType ):
343291 node = Node .Field ()
@@ -374,7 +322,7 @@ class Query(graphene.ObjectType):
374322 expected , sort_keys = True )
375323
376324
377- def test_should_get_node_by_id ():
325+ def test_should_get_node_by_id (setup_fixtures ):
378326 # Notes: https://goo.gl/hMNRgs
379327 class Query (graphene .ObjectType ):
380328 reporter = Node .Field (ReporterNode )
@@ -400,7 +348,7 @@ class Query(graphene.ObjectType):
400348 assert result .data == expected
401349
402350
403- def test_should_first_n ():
351+ def test_should_first_n (setup_fixtures ):
404352
405353 class Query (graphene .ObjectType ):
406354
@@ -456,7 +404,7 @@ class Query(graphene.ObjectType):
456404 for item in get_nodes (expected , 'editors' ))
457405
458406
459- def test_should_after ():
407+ def test_should_after (setup_fixtures ):
460408 class Query (graphene .ObjectType ):
461409
462410 players = MongoengineConnectionField (PlayerNode )
@@ -499,7 +447,7 @@ class Query(graphene.ObjectType):
499447 expected , sort_keys = True )
500448
501449
502- def test_should_before ():
450+ def test_should_before (setup_fixtures ):
503451 class Query (graphene .ObjectType ):
504452
505453 players = MongoengineConnectionField (PlayerNode )
@@ -542,7 +490,7 @@ class Query(graphene.ObjectType):
542490 expected , sort_keys = True )
543491
544492
545- def test_should_last_n ():
493+ def test_should_last_n (setup_fixtures ):
546494 class Query (graphene .ObjectType ):
547495 players = MongoengineConnectionField (PlayerNode )
548496
@@ -584,7 +532,7 @@ class Query(graphene.ObjectType):
584532 expected , sort_keys = True )
585533
586534
587- def test_should_self_reference ():
535+ def test_should_self_reference (setup_fixtures ):
588536
589537 class Query (graphene .ObjectType ):
590538
@@ -683,8 +631,3 @@ class Query(graphene.ObjectType):
683631 assert not result .errors
684632 assert json .dumps (result .data , sort_keys = True ) == json .dumps (
685633 expected , sort_keys = True )
686-
687-
688- # TODO:
689- def test_should_paging ():
690- pass
0 commit comments