py-libp2p/tests/host/test_basic_host.py
2020-01-26 16:44:42 +08:00

17 lines
560 B
Python

from libp2p import new_swarm
from libp2p.crypto.rsa import create_new_key_pair
from libp2p.host.basic_host import BasicHost
from libp2p.host.defaults import get_default_protocols
def test_default_protocols():
key_pair = create_new_key_pair()
swarm = new_swarm(key_pair)
host = BasicHost(swarm)
mux = host.get_mux()
handlers = mux.handlers
# NOTE: comparing keys for equality as handlers may be closures that do not compare in the way
# this test is concerned with
assert handlers.keys() == get_default_protocols(host).keys()