kubo/core/commands/dht_test.go
hannahhoward 0963c9cdcb Update go-ipfs-delay and assoc deps
License: MIT
Signed-off-by: hannahhoward <hannah@hannahhoward.net>
2018-11-15 18:53:45 -08:00

35 lines
650 B
Go

package commands
import (
"testing"
"github.com/ipfs/go-ipfs/namesys"
ipns "gx/ipfs/QmR9UpasSQR4Mqq1qiJAfnY4SVBxJn7r639CxiLjx8dYGm/go-ipns"
tu "gx/ipfs/QmZXjR5X1p4KrQ967cTsy4MymMzUM8mZECF3PV8UcN4o3g/go-testutil"
)
func TestKeyTranslation(t *testing.T) {
pid := tu.RandPeerIDFatal(t)
pkname := namesys.PkKeyForID(pid)
ipnsname := ipns.RecordKey(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 != pkname {
t.Fatal("keys didnt match!")
}
if ipnsk != ipnsname {
t.Fatal("keys didnt match!")
}
}