1
0
mirror of https://github.com/ipfs/kubo.git synced 2025-06-04 13:07:46 +08:00
Files
kubo/core/coreunix/add_test.go
Ho-Sheng Hsiao bf22aeec0a Reorged imports from jbenet/go-ipfs to ipfs/go-ipfs
- Modified Godeps/Godeps.json by hand
- [TEST] Updated welcome docs hash to sharness
- [TEST] Updated contact doc
- [TEST] disabled breaking test (t0080-repo refs local)
2015-03-31 12:52:25 -07:00

38 lines
841 B
Go

package coreunix
import (
"os"
"path"
"testing"
"github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
"github.com/ipfs/go-ipfs/core"
"github.com/ipfs/go-ipfs/repo"
"github.com/ipfs/go-ipfs/repo/config"
"github.com/ipfs/go-ipfs/util/testutil"
)
func TestAddRecursive(t *testing.T) {
here, err := os.Getwd()
if err != nil {
t.Fatal(err)
}
r := &repo.Mock{
C: config.Config{
Identity: config.Identity{
PeerID: "Qmfoo", // required by offline node
},
},
D: testutil.ThreadSafeCloserMapDatastore(),
}
node, err := core.NewIPFSNode(context.Background(), core.Offline(r))
if err != nil {
t.Fatal(err)
}
if k, err := AddR(node, path.Join(here, "test_data")); err != nil {
t.Fatal(err)
} else if k != "QmWCCga8AbTyfAQ7pTnGT6JgmRMAB3Qp8ZmTEFi5q5o8jC" {
t.Fatal("keys do not match")
}
}