mirror of
https://github.com/ipfs/kubo.git
synced 2025-06-04 22:29:23 +08:00

Importantly: * fixes a bunch of MFS bugs * pulls in some bitswap improvements License: MIT Signed-off-by: Steven Allen <steven@stebalien.com>
35 lines
650 B
Go
35 lines
650 B
Go
package commands
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/ipfs/go-ipfs/namesys"
|
|
|
|
tu "gx/ipfs/QmNvHv84aH2qZafDuSdKJCQ1cvPZ1kmQmyD4YtzjUHuk9v/go-testutil"
|
|
ipns "gx/ipfs/QmWPFehHmySCdaGttQ48iwF7M6mBRrGE5GSPWKCuMWqJDR/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!")
|
|
}
|
|
}
|