From adf62a39d58cf6b43e483233c32865e52bba5d94 Mon Sep 17 00:00:00 2001
From: Brian Tiger Chow <brian.holderchow@gmail.com>
Date: Mon, 15 Sep 2014 07:25:23 -0700
Subject: [PATCH] refac(bitswap:notif) replace block generating func

---
 bitswap/notifications/notifications_test.go | 13 +++----------
 1 file changed, 3 insertions(+), 10 deletions(-)

diff --git a/bitswap/notifications/notifications_test.go b/bitswap/notifications/notifications_test.go
index 487474e2..b12cc7d8 100644
--- a/bitswap/notifications/notifications_test.go
+++ b/bitswap/notifications/notifications_test.go
@@ -6,12 +6,13 @@ import (
 	"time"
 
 	context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"
+	testutil "github.com/jbenet/go-ipfs/util/testutil"
 
 	blocks "github.com/jbenet/go-ipfs/blocks"
 )
 
 func TestPublishSubscribe(t *testing.T) {
-	blockSent := getBlockOrFail(t, "Greetings from The Interval")
+	blockSent := testutil.NewBlockOrFail(t, "Greetings from The Interval")
 
 	n := New()
 	defer n.Shutdown()
@@ -34,7 +35,7 @@ func TestCarryOnWhenDeadlineExpires(t *testing.T) {
 
 	n := New()
 	defer n.Shutdown()
-	block := getBlockOrFail(t, "A Missed Connection")
+	block := testutil.NewBlockOrFail(t, "A Missed Connection")
 	blockChannel := n.Subscribe(fastExpiringCtx, block.Key())
 
 	assertBlockChannelNil(t, blockChannel)
@@ -55,11 +56,3 @@ func assertBlocksEqual(t *testing.T, a, b blocks.Block) {
 		t.Fail()
 	}
 }
-
-func getBlockOrFail(t *testing.T, msg string) blocks.Block {
-	block, blockCreationErr := blocks.NewBlock([]byte(msg))
-	if blockCreationErr != nil {
-		t.Fail()
-	}
-	return *block
-}
-- 
GitLab