Add testutil package and function to generate a dagservice
Jeromy committed
Oct 31, 2014 at 06:02 UTC
b02dbc4a6b26543c0bbe96a49532832c74958376
1 file changed
+18
util/testutil/gen.go
new
+18
@@ -0,0 +1,18 @@
1
+package testutil
2
+
3
+import (
4
+ "testing"
5
+
6
+ ds "github.com/jbenet/go-ipfs/Godeps/_workspace/src/github.com/jbenet/go-datastore"
7
+ bsrv "github.com/jbenet/go-ipfs/blockservice"
8
+ dag "github.com/jbenet/go-ipfs/merkledag"
9
+)
10
+
11
+func GetDAGServ(t testing.TB) dag.DAGService {
12
+ dstore := ds.NewMapDatastore()
13
+ bserv, err := bsrv.NewBlockService(dstore, nil)
14
+ if err != nil {
15
+ t.Fatal(err)
16
+ }
17
+ return dag.NewDAGService(bserv)
18
+}