-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
Added the original logic to check for a invalid path and a simple test.
- Loading branch information
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
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" | ||
) | ||
|
||
func TestResolveInvalidPath(t *testing.T) { | ||
ctx := context.TODO() | ||
This comment has been minimized.
Sorry, something went wrong.
This comment has been minimized.
Sorry, something went wrong. |
||
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)) | ||
This comment has been minimized.
Sorry, something went wrong.
wking
|
||
if n == nil || err != nil { | ||
t.Error("Should have constructed.", err) | ||
} | ||
|
||
_, err = Resolve(ctx, n, path.Path("/ipfs/")) | ||
if err == nil { | ||
t.Error("Should get invalid path") | ||
This comment has been minimized.
Sorry, something went wrong.
wking
|
||
} | ||
|
||
} |
In ipfs#1208, @jbenet pointed out that
context.Background()
is a better choice for tests (so you can grep for TODO to see things that you indend to fix later).