MCPcopy
hub / github.com/ipfs/kubo / TestKeyTranslation

Function TestKeyTranslation

core/commands/dht_test.go:12–34  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

10)
11
12func TestKeyTranslation(t *testing.T) {
13 pid := test.RandPeerIDFatal(t)
14 pkname := namesys.PkRoutingKey(pid)
15 ipnsname := ipns.NameFromPeer(pid).RoutingKey()
16
17 pkk, err := escapeDhtKey("/pk/" + pid.String())
18 if err != nil {
19 t.Fatal(err)
20 }
21
22 ipnsk, err := escapeDhtKey("/ipns/" + pid.String())
23 if err != nil {
24 t.Fatal(err)
25 }
26
27 if pkk != pkname {
28 t.Fatal("keys didn't match!")
29 }
30
31 if ipnsk != string(ipnsname) {
32 t.Fatal("keys didn't match!")
33 }
34}

Callers

nothing calls this directly

Calls 3

escapeDhtKeyFunction · 0.85
FatalMethod · 0.80
StringMethod · 0.45

Tested by

no test coverage detected