For testing purposes it is often useful to replace the client used for communication with the crate server with a stub or mock.
This can be done by passing a object of the Client class when calling the connect method:
>>> from crate import client
>>> class MyConnectionClient:
... active_servers = ["localhost:4200"]
... def __init__(self):
... pass
... def sql(self, stmt=None, parameters=None):
... pass
... def server_infos(self, server):
... return ("localhost:4200", "my server", "0.42.0")
>>> connection = client.connect([crate_host], client=MyConnectionClient())
或是邮件反馈可也:
askdama[AT]googlegroups.com
订阅 substack 体验古早写作:
关注公众号, 持续获得相关各种嗯哼: