forked from thingsdb/python-thingsdb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_thingsdb.py
More file actions
31 lines (22 loc) · 800 Bytes
/
test_thingsdb.py
File metadata and controls
31 lines (22 loc) · 800 Bytes
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
import unittest
import asyncio
from thingsdb.client import Client
class TestPlayground(unittest.TestCase):
async def async_test_playground(self):
want = "Welcome at ThingsDB!"
client = Client(ssl=True)
await client.connect('playground.thingsdb.net', 9400)
try:
await client.authenticate('Fai6NmH7QYxA6WLYPdtgcy')
data = await client.query(
code='.greetings[index];',
index=1,
scope='//Doc')
self.assertEqual(data, want)
finally:
client.close()
await client.wait_closed()
def test_playground(self):
loop = asyncio.get_event_loop()
loop.run_until_complete(self.async_test_playground())
TestPlayground().test_playground()