restic/object_test.go

34 lines
468 B
Go
Raw Normal View History

2014-08-04 18:47:04 +00:00
package khepri_test
import (
"testing"
"github.com/fd0/khepri"
)
func TestObjects(t *testing.T) {
repo, err := setupRepo()
ok(t, err)
defer func() {
err = teardownRepo(repo)
ok(t, err)
}()
for _, test := range TestStrings {
2014-08-04 20:46:14 +00:00
obj, ch, err := repo.Create(khepri.TYPE_BLOB)
2014-08-04 18:47:04 +00:00
ok(t, err)
_, err = obj.Write([]byte(test.data))
ok(t, err)
2014-08-04 20:46:14 +00:00
err = obj.Close()
ok(t, err)
2014-08-04 18:47:04 +00:00
id, err := khepri.ParseID(test.id)
ok(t, err)
2014-08-04 20:46:14 +00:00
equals(t, id, <-ch)
2014-08-04 18:47:04 +00:00
}
}