func TestBlockReturnsErr(t *testing.T) { off := Exchange(bstore()) _, err := off.GetBlock(context.Background(), key.Key("foo")) if err != nil { return // as desired } t.Fail() }
func TestGetWhenKeyNotPresent(t *testing.T) { bs := NewBlockstore(ds_sync.MutexWrap(ds.NewMapDatastore())) _, err := bs.Get(key.Key("not present")) if err != nil { t.Log("As expected, block is not present") return } t.Fail() }
// Key returns the block's Multihash as a Key value. func (b *Block) Key() key.Key { return key.Key(b.Multihash) }