def test_should_custom_identifier():
class EditorNode(PynamoObjectType):
class Meta:
model = Editor
interfaces = (Node,)
class Query(graphene.ObjectType):
node = Node.Field()
all_editors = PynamoConnectionField(EditorNode)
query = '''
query EditorQuery {
allEditors {
edges {
node {
id,
name
}
}
},
node(id: "RWRpdG9yTm9kZTox") {
...on EditorNode {
name
}
}
}
'''
expected = {
'allEditors': {
'edges': [{
'node': {
'id': 'RWRpdG9yTm9kZTox',
'name': 'John'
}
}]
},
'node': {
'name': 'John'
}
}
schema = graphene.Schema(query=Query)
result = schema.execute(query)
assert not result.errors
assert result.data['allEditors'] == expected['allEditors']
评论列表
文章目录