2019-10-24 16:36:34 +08:00
|
|
|
from libp2p import initialize_default_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 = initialize_default_swarm(key_pair)
|
2019-11-25 22:05:33 +08:00
|
|
|
host = BasicHost(swarm)
|
2019-10-24 16:36:34 +08:00
|
|
|
|
|
|
|
mux = host.get_mux()
|
|
|
|
handlers = mux.handlers
|
2019-11-07 07:04:17 +08:00
|
|
|
# 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()
|