[英]How to unit test Gremlin Queries on JanusGraph using FastAPI and GremlinPython
I have written a Python REST API using FastAPI.我使用 FastAPI 编写了 Python REST API。 It connects to Janus Graph on a remote machine and runs some Gremlin Queries using the GremlinPython API.
它连接到远程机器上的 Janus Graph 并使用 GremlinPython API 运行一些 Gremlin 查询。 While writing my unit tests using FastAPI's built in test client, I cannot mock Janus Graph and test my APIs.
在使用 FastAPI 的内置测试客户端编写单元测试时,我无法模拟 Janus Graph 并测试我的 API。 In the worst case I need to run Janus on docker in my local setup and test there.
在最坏的情况下,我需要在我的本地设置中在 docker 上运行 Janus 并在那里进行测试。 However, I would like to do a pure unit test.
但是,我想做一个纯单元测试。 I've not come across any useful documentation so far.
到目前为止,我还没有遇到任何有用的文档。 Can anyone please help?
有人可以帮忙吗?
I think running Gremlin Server locally is how a lot of people do local testing.我认为在本地运行 Gremlin Server 是很多人进行本地测试的方式。 If you do not need to test data persistence you could configure JanusGraph to use the "inmemory" backend and avoid the need to provision any storage nodes.
如果您不需要测试数据持久性,您可以将 JanusGraph 配置为使用“inmemory”后端并避免配置任何存储节点。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.