Пример #1
0
func TestBlockReturnsErr(t *testing.T) {
	off := Exchange(bstore())
	_, err := off.GetBlock(context.Background(), key.Key("foo"))
	if err != nil {
		return // as desired
	}
	t.Fail()
}
Пример #2
0
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()
}
Пример #3
0
// Key returns the block's Multihash as a Key value.
func (b *Block) Key() key.Key {
	return key.Key(b.Multihash)
}