First test implementation

This commit is contained in:
Alexander Neumann 2014-04-21 23:25:31 +02:00
parent b24390909c
commit 4f3a54dc40
6 changed files with 293 additions and 42 deletions

View file

@ -2,7 +2,6 @@ package storage_test
import (
"bytes"
"encoding/hex"
"io"
"io/ioutil"
"os"
@ -55,7 +54,7 @@ var _ = Describe("Storage", func() {
Context("File Operations", func() {
It("Should detect non-existing file", func() {
for _, test := range TestStrings {
id, err := hex.DecodeString(test.id)
id, err := storage.ParseID(test.id)
Expect(err).NotTo(HaveOccurred())
// try to get string out, should fail
@ -96,6 +95,15 @@ var _ = Describe("Storage", func() {
Expect(repo.Remove(id))
}
})
It("Should Add Buffer", func() {
for _, test := range TestStrings {
// store buf in repository
id, err := repo.PutRaw([]byte(test.data))
Expect(err).NotTo(HaveOccurred())
Expect(id.String()).To(Equal(test.id))
}
})
})
})
})