forked from xmonader/pygundb
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathtestclient.py
37 lines (31 loc) · 805 Bytes
/
testclient.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import asyncio
from gundb.client import GunClient
from gundb.backends import *
async def test():
import sys
argv = sys.argv
backend = DummyKV()
if "dummy" in argv:
backend = DummyKV()
elif "memory" in argv:
backend = Memory()
elif "redis" in argv:
backend = RedisKV()
elif "udb" in argv:
backend = UDB()
elif "pickle" in argv:
backend = Pickle()
c = GunClient()
c.backend = backend
print(c.backend.db)
await c.put('box://1', w=101, h=30)
box = await c.get('box://1')
print("Box is: ", box)
w = await c.get('box://1', 'w')
print("W is : ", w)
print(c.backend.db)
def cltest():
loop = asyncio.get_event_loop()
loop.run_until_complete(test())
if __name__ == "__main__":
cltest()