简体   繁体   中英

How to unit test Gremlin Queries on JanusGraph using FastAPI and GremlinPython

I have written a Python REST API using FastAPI. It connects to Janus Graph on a remote machine and runs some Gremlin Queries using the GremlinPython API. While writing my unit tests using FastAPI's built in test client, I cannot mock Janus Graph and test my APIs. In the worst case I need to run Janus on docker in my local setup and test there. 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. 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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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