File tree 2 files changed +24
-0
lines changed 2 files changed +24
-0
lines changed Original file line number Diff line number Diff line change @@ -23,6 +23,15 @@ def __getattr__(self, name):
23
23
type_def = self .schema .get_type (name )
24
24
return DSLType (type_def )
25
25
26
+ def query (self , * args , ** kwargs ):
27
+ return self .execute (query (* args , ** kwargs ))
28
+
29
+ def mutate (self , * args , ** kwargs ):
30
+ return self .query (* args , operation = 'mutate' , ** kwargs )
31
+
32
+ def execute (self , document ):
33
+ return self .client .execute (document )
34
+
26
35
27
36
class DSLType (object ):
28
37
def __init__ (self , type ):
Original file line number Diff line number Diff line change @@ -277,3 +277,18 @@ def test_fetch_luke_aliased(ds):
277
277
# result = schema.execute(query)
278
278
# assert not result.errors
279
279
# assert result.data == expected
280
+
281
+
282
+
283
+ def test_hero_name_query (ds ):
284
+ result = ds .query (
285
+ ds .Query .hero .select (
286
+ ds .Character .name
287
+ )
288
+ )
289
+ expected = {
290
+ 'hero' : {
291
+ 'name' : 'R2-D2'
292
+ }
293
+ }
294
+ assert result == expected
You can’t perform that action at this time.
0 commit comments