1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-08-06 03:19:47 +08:00
Files
kubo/core/commands/dht_test.go
Jeromy c5b2e09708 test for the dht key escaping
License: MIT
Signed-off-by: Jeromy <jeromyj@gmail.com>
2016-04-08 11:23:21 -07:00

32 lines
511 B
Go

package commands
import (
"testing"
"github.com/ipfs/go-ipfs/namesys"
tu "github.com/ipfs/go-ipfs/thirdparty/testutil"
)
func TestKeyTranslation(t *testing.T) {
pid := tu.RandPeerIDFatal(t)
a, b := namesys.IpnsKeysForID(pid)
pkk, err := escapeDhtKey("/pk/" + pid.Pretty())
if err != nil {
t.Fatal(err)
}
ipnsk, err := escapeDhtKey("/ipns/" + pid.Pretty())
if err != nil {
t.Fatal(err)
}
if pkk != a {
t.Fatal("keys didnt match!")
}
if ipnsk != b {
t.Fatal("keys didnt match!")
}
}