kubo/core/commands/dht_test.go
Steven Allen c97c3459be gx update
License: MIT
Signed-off-by: Steven Allen <steven@stebalien.com>
2018-10-24 09:59:43 -07:00

35 lines
650 B
Go

package commands
import (
"testing"
"github.com/ipfs/go-ipfs/namesys"
tu "gx/ipfs/Qma6ESRQTf1ZLPgzpCwDTqQJefPnU6uLvMjP18vK8EWp8L/go-testutil"
ipns "gx/ipfs/QmaRFtZhVAwXBk4Z3zEsvjScH9fjsDZmhXfa1Gm8eMb9cg/go-ipns"
)
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!")
}
}