测试 Graphql(石墨烯)模式
Test Graphql (Graphene) Schema
我一直在查看 https://media.readthedocs.org/pdf/graphene-python/latest/graphene-python.pdf 以获取有关如何测试我的 graphql(Graphene,因为我有一个 python flask 应用程序)架构是否正确加载的指导。 None 我安装的 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
个可用。
至此 time,graphene.test.Client
存在。
我一直在查看 https://media.readthedocs.org/pdf/graphene-python/latest/graphene-python.pdf 以获取有关如何测试我的 graphql(Graphene,因为我有一个 python flask 应用程序)架构是否正确加载的指导。 None 我安装的 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
个可用。
至此 time,graphene.test.Client
存在。