File tree Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Expand file tree Collapse file tree 1 file changed +39
-0
lines changed Original file line number Diff line number Diff line change 1
1
import base64
2
+ import json
2
3
import os
3
4
import pytest
4
5
@@ -925,3 +926,41 @@ class Query(graphene.ObjectType):
925
926
result = schema .execute (query )
926
927
assert not result .errors
927
928
assert result .data == expected
929
+
930
+
931
+ def test_should_filter_mongoengine_queryset (fixtures ):
932
+ class Query (graphene .ObjectType ):
933
+ players = MongoengineConnectionField (PlayerNode )
934
+
935
+ query = '''
936
+ query players {
937
+ players(firstName_Istartswith: "M") {
938
+ edges {
939
+ node {
940
+ firstName
941
+ }
942
+ }
943
+ }
944
+ }
945
+ '''
946
+ expected = {
947
+ 'players' : {
948
+ 'edges' : [
949
+ {
950
+ 'node' : {
951
+ 'firstName' : 'Michael' ,
952
+ }
953
+ },
954
+ {
955
+ 'node' : {
956
+ 'firstName' : 'Magic'
957
+ }
958
+ }
959
+ ]
960
+ }
961
+ }
962
+ schema = graphene .Schema (query = Query )
963
+ result = schema .execute (query )
964
+
965
+ assert not result .errors
966
+ assert json .dumps (result .data , sort_keys = True ) == json .dumps (expected , sort_keys = True )
You can’t perform that action at this time.
0 commit comments