@cryptotaxi247 / kubo / commits / adf62a39d

refac(bitswap:notif) replace block generating func

Brian Tiger Chow committed Sep 15, 2014 at 07:25 UTC adf62a39d58cf6b43e483233c32865e52bba5d94
1 file changed +3 -10
bitswap/notifications/notifications_test.go
+3 -10
@@ -6,12 +6,13 @@ import (
6 "time"
7
8 context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
9 + testutil "github.com/jbenet/go-ipfs/util/testutil"
10
11 blocks "github.com/jbenet/go-ipfs/blocks"
12 )
13
14 func TestPublishSubscribe(t *testing.T) {
14 - blockSent := getBlockOrFail(t, "Greetings from The Interval")
15 + blockSent := testutil.NewBlockOrFail(t, "Greetings from The Interval")
16
17 n := New()
18 defer n.Shutdown()
@@ -34,7 +35,7 @@ func TestCarryOnWhenDeadlineExpires(t *testing.T) {
35
36 n := New()
37 defer n.Shutdown()
37 - block := getBlockOrFail(t, "A Missed Connection")
38 + block := testutil.NewBlockOrFail(t, "A Missed Connection")
39 blockChannel := n.Subscribe(fastExpiringCtx, block.Key())
40
41 assertBlockChannelNil(t, blockChannel)
@@ -55,11 +56,3 @@ func assertBlocksEqual(t *testing.T, a, b blocks.Block) {
56 t.Fail()
57 }
58 }
58 -
59 -func getBlockOrFail(t *testing.T, msg string) blocks.Block {
60 - block, blockCreationErr := blocks.NewBlock([]byte(msg))
61 - if blockCreationErr != nil {
62 - t.Fail()
63 - }
64 - return *block
65 -}