offline_test.go 598 Bytes
Newer Older
Jeromy's avatar
Jeromy committed
1
package offline
2 3 4 5 6 7

import (
	"testing"

	context "github.com/jbenet/go-ipfs/Godeps/_workspace/src/code.google.com/p/go.net/context"

8
	blocks "github.com/jbenet/go-ipfs/blocks"
9 10 11 12 13 14 15 16 17 18 19 20 21 22
	u "github.com/jbenet/go-ipfs/util"
)

func TestBlockReturnsErr(t *testing.T) {
	off := NewOfflineExchange()
	_, err := off.Block(context.Background(), u.Key("foo"))
	if err != nil {
		return // as desired
	}
	t.Fail()
}

func TestHasBlockReturnsNil(t *testing.T) {
	off := NewOfflineExchange()
23 24
	block := blocks.NewBlock([]byte("data"))
	err := off.HasBlock(context.Background(), *block)
25 26 27 28
	if err != nil {
		t.Fatal("")
	}
}