提交 d96246c6 作者: Travis Person

Fixed tests to actually test for the error we are seeking

Cleaned the tests, and actually test for the error.
上级 dcc4da0b
......@@ -3,39 +3,19 @@ package core
import (
"testing"
context "github.com/ipfs/go-ipfs/Godeps/_workspace/src/golang.org/x/net/context"
config "github.com/ipfs/go-ipfs/repo/config"
"github.com/ipfs/go-ipfs/util/testutil"
"github.com/ipfs/go-ipfs/repo"
path "github.com/ipfs/go-ipfs/path"
"strings"
)
func TestResolveInvalidPath(t *testing.T) {
ctx := context.TODO()
id := testIdentity
r := &repo.Mock{
C: config.Config{
Identity: id,
Datastore: config.Datastore{
Type: "memory",
},
Addresses: config.Addresses{
Swarm: []string{"/ip4/0.0.0.0/tcp/4001"},
API: "/ip4/127.0.0.1/tcp/8000",
},
},
D: testutil.ThreadSafeCloserMapDatastore(),
}
n, err := NewIPFSNode(ctx, Standard(r, false))
n, err := NewMockNode()
if n == nil || err != nil {
t.Error("Should have constructed.", err)
t.Fatal("Should have constructed.", err)
}
_, err = Resolve(ctx, n, path.Path("/ipfs/"))
if err == nil {
t.Error("Should get invalid path")
_, err = Resolve(n.Context(), n, path.Path("/ipfs/"))
if !strings.HasPrefix(err.Error(), "invalid path") {
t.Fatal("Should get invalid path.", err)
}
}
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论