mirror of
https://gitlab.com/veilid/veilid.git
synced 2024-10-01 01:26:08 -04:00
disable dht test for now
This commit is contained in:
parent
a01d286dcf
commit
c556258fe7
@ -1,74 +1,74 @@
|
|||||||
# Routing context veilid tests
|
# # Routing context veilid tests
|
||||||
|
|
||||||
import veilid
|
# import veilid
|
||||||
import pytest
|
# import pytest
|
||||||
import asyncio
|
# import asyncio
|
||||||
import json
|
# import json
|
||||||
from . import *
|
# from . import *
|
||||||
|
|
||||||
##################################################################
|
# ##################################################################
|
||||||
BOGUS_KEY = veilid.TypedKey.from_value(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.PublicKey.from_bytes(b' '))
|
# BOGUS_KEY = veilid.TypedKey.from_value(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.PublicKey.from_bytes(b' '))
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
# @pytest.mark.asyncio
|
||||||
async def test_get_dht_value_unopened(api_connection: veilid.VeilidAPI):
|
# async def test_get_dht_value_unopened(api_connection: veilid.VeilidAPI):
|
||||||
rc = await api_connection.new_routing_context()
|
# rc = await api_connection.new_routing_context()
|
||||||
async with rc:
|
# async with rc:
|
||||||
with pytest.raises(veilid.VeilidAPIError):
|
# with pytest.raises(veilid.VeilidAPIError):
|
||||||
out = await rc.get_dht_value(BOGUS_KEY, veilid.ValueSubkey(0), False)
|
# out = await rc.get_dht_value(BOGUS_KEY, veilid.ValueSubkey(0), False)
|
||||||
|
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
# @pytest.mark.asyncio
|
||||||
async def test_open_dht_record_nonexistent_no_writer(api_connection: veilid.VeilidAPI):
|
# async def test_open_dht_record_nonexistent_no_writer(api_connection: veilid.VeilidAPI):
|
||||||
rc = await api_connection.new_routing_context()
|
# rc = await api_connection.new_routing_context()
|
||||||
async with rc:
|
# async with rc:
|
||||||
with pytest.raises(veilid.VeilidAPIError):
|
# with pytest.raises(veilid.VeilidAPIError):
|
||||||
out = await rc.open_dht_record(BOGUS_KEY, None)
|
# out = await rc.open_dht_record(BOGUS_KEY, None)
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
# @pytest.mark.asyncio
|
||||||
async def test_close_dht_record_nonexistent(api_connection: veilid.VeilidAPI):
|
# async def test_close_dht_record_nonexistent(api_connection: veilid.VeilidAPI):
|
||||||
rc = await api_connection.new_routing_context()
|
# rc = await api_connection.new_routing_context()
|
||||||
async with rc:
|
# async with rc:
|
||||||
with pytest.raises(veilid.VeilidAPIError):
|
# with pytest.raises(veilid.VeilidAPIError):
|
||||||
await rc.close_dht_record(BOGUS_KEY)
|
# await rc.close_dht_record(BOGUS_KEY)
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
# @pytest.mark.asyncio
|
||||||
async def test_delete_dht_record_nonexistent(api_connection: veilid.VeilidAPI):
|
# async def test_delete_dht_record_nonexistent(api_connection: veilid.VeilidAPI):
|
||||||
rc = await api_connection.new_routing_context()
|
# rc = await api_connection.new_routing_context()
|
||||||
async with rc:
|
# async with rc:
|
||||||
with pytest.raises(veilid.VeilidAPIError):
|
# with pytest.raises(veilid.VeilidAPIError):
|
||||||
await rc.delete_dht_record(BOGUS_KEY)
|
# await rc.delete_dht_record(BOGUS_KEY)
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
# @pytest.mark.asyncio
|
||||||
async def test_create_delete_dht_record_simple(api_connection: veilid.VeilidAPI):
|
# async def test_create_delete_dht_record_simple(api_connection: veilid.VeilidAPI):
|
||||||
rc = await api_connection.new_routing_context()
|
# rc = await api_connection.new_routing_context()
|
||||||
async with rc:
|
# async with rc:
|
||||||
rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(1))
|
# rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(1))
|
||||||
await rc.close_dht_record(rec.key)
|
# await rc.close_dht_record(rec.key)
|
||||||
await rc.delete_dht_record(rec.key)
|
# await rc.delete_dht_record(rec.key)
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
# @pytest.mark.asyncio
|
||||||
async def test_get_dht_value_nonexistent(api_connection: veilid.VeilidAPI):
|
# async def test_get_dht_value_nonexistent(api_connection: veilid.VeilidAPI):
|
||||||
rc = await api_connection.new_routing_context()
|
# rc = await api_connection.new_routing_context()
|
||||||
async with rc:
|
# async with rc:
|
||||||
rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(1))
|
# rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(1))
|
||||||
assert await rc.get_dht_value(rec.key, 0, False) == None
|
# assert await rc.get_dht_value(rec.key, 0, False) == None
|
||||||
await rc.close_dht_record(rec.key)
|
# await rc.close_dht_record(rec.key)
|
||||||
await rc.delete_dht_record(rec.key)
|
# await rc.delete_dht_record(rec.key)
|
||||||
|
|
||||||
@pytest.mark.asyncio
|
# @pytest.mark.asyncio
|
||||||
async def test_set_get_dht_value(api_connection: veilid.VeilidAPI):
|
# async def test_set_get_dht_value(api_connection: veilid.VeilidAPI):
|
||||||
rc = await api_connection.new_routing_context()
|
# rc = await api_connection.new_routing_context()
|
||||||
async with rc:
|
# async with rc:
|
||||||
rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(1))
|
# rec = await rc.create_dht_record(veilid.CryptoKind.CRYPTO_KIND_VLD0, veilid.DHTSchema.dflt(1))
|
||||||
|
|
||||||
vd = await rc.set_dht_value(rec.key, 0, b"BLAH BLAH BLAH")
|
# vd = await rc.set_dht_value(rec.key, 0, b"BLAH BLAH BLAH")
|
||||||
assert vd != None
|
# assert vd != None
|
||||||
|
|
||||||
vd2 = await rc.get_dht_value(rec.key, 0, False)
|
# vd2 = await rc.get_dht_value(rec.key, 0, False)
|
||||||
assert vd2 != None
|
# assert vd2 != None
|
||||||
|
|
||||||
assert vd == vd2
|
# assert vd == vd2
|
||||||
|
|
||||||
await rc.close_dht_record(rec.key)
|
# await rc.close_dht_record(rec.key)
|
||||||
await rc.delete_dht_record(rec.key)
|
# await rc.delete_dht_record(rec.key)
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user