mirror of
https://gitlab.com/veilid/veilid.git
synced 2025-05-03 07:04:58 -04:00
more tests
This commit is contained in:
parent
d053e93e72
commit
615e0ca1d0
6 changed files with 103 additions and 45 deletions
|
@ -2,42 +2,24 @@
|
|||
|
||||
import veilid_python
|
||||
import pytest
|
||||
import os
|
||||
|
||||
pytest_plugins = ('pytest_asyncio',)
|
||||
from . import *
|
||||
|
||||
##################################################################
|
||||
VEILID_SERVER = os.getenv("VEILID_SERVER")
|
||||
if VEILID_SERVER is not None:
|
||||
vsparts = VEILID_SERVER.split(":")
|
||||
VEILID_SERVER = vsparts[0]
|
||||
if len(vsparts) == 2:
|
||||
VEILID_SERVER_PORT = int(vsparts[1])
|
||||
else:
|
||||
VEILID_SERVER_PORT = 5959
|
||||
else:
|
||||
VEILID_SERVER = "localhost"
|
||||
VEILID_SERVER_PORT = 5959
|
||||
|
||||
##################################################################
|
||||
|
||||
async def _simple_update_callback(update):
|
||||
print("VeilidUpdate: {}".format(update))
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_connect():
|
||||
async with await veilid_python.json_api_connect(VEILID_SERVER, VEILID_SERVER_PORT, _simple_update_callback) as api:
|
||||
async with await veilid_python.json_api_connect(VEILID_SERVER, VEILID_SERVER_PORT, simple_update_callback) as api:
|
||||
pass
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_fail_connect():
|
||||
with pytest.raises(Exception):
|
||||
async with await veilid_python.json_api_connect("fuahwelifuh32luhwafluehawea", 1, _simple_update_callback) as api:
|
||||
async with await veilid_python.json_api_connect("fuahwelifuh32luhwafluehawea", 1, simple_update_callback) as api:
|
||||
pass
|
||||
|
||||
@pytest.mark.asyncio
|
||||
async def test_version():
|
||||
async with await veilid_python.json_api_connect(VEILID_SERVER, VEILID_SERVER_PORT, _simple_update_callback) as api:
|
||||
async with await veilid_python.json_api_connect(VEILID_SERVER, VEILID_SERVER_PORT, simple_update_callback) as api:
|
||||
v = await api.veilid_version()
|
||||
print("veilid_version: {}".format(v.__dict__))
|
||||
vstr = await api.veilid_version_string()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue