繁体   English   中英

测试Graphql(石墨烯)架构

[英]Test Graphql (Graphene) Schema

我一直在查看https://media.readthedocs.org/pdf/graphene-python/latest/graphene-python.pdf,以获取有关如何测试我的graphql的指导(石墨烯,实际上是因为我有一个python flask应用程序)模式正确加载。 我安装的Graphene版本均不支持该示例显示的内容,因此我觉得很茫然。

from graphene.test import Client

def test_hey():
    client = Client(my_schema)
    executed = client.execute('''{ hey }''', context_value={'user': 'Peter'})
    assert executed == {
        'data': {
             'hey': 'hello Peter!'
        }
    }

我收到的错误: NameError: global name 'Client' is not defined表明Client在石墨烯领域中不存在。 有没有人遇到这个问题?

您需要确保在测试范围内有可用的graphene

截至本graphene.test.Client存在。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM