Implement Read Only mode
This commit is contained in:
parent
6464d92dd4
commit
e1bd235785
19 changed files with 544 additions and 335 deletions
|
@ -25,11 +25,11 @@ const (
|
|||
)
|
||||
|
||||
func TestInit(t *testing.T) {
|
||||
st, err := Init(test_path)
|
||||
_, err := Init(test_path)
|
||||
if err != nil {
|
||||
t.Fatal("An error ocurred initializing the store =>", err)
|
||||
}
|
||||
defer st.del()
|
||||
defer del()
|
||||
|
||||
info, err := os.Stat(test_path)
|
||||
if err != nil {
|
||||
|
@ -50,7 +50,7 @@ func TestInit(t *testing.T) {
|
|||
|
||||
func TestStore(t *testing.T) {
|
||||
st, err := Init(test_path)
|
||||
defer st.del()
|
||||
defer del()
|
||||
|
||||
_, err = st.Store(test_id, strings.NewReader(test_book), "epub")
|
||||
if err != nil {
|
||||
|
@ -72,7 +72,7 @@ func TestStore(t *testing.T) {
|
|||
|
||||
func TestCreate(t *testing.T) {
|
||||
st, err := Init(test_path)
|
||||
defer st.del()
|
||||
defer del()
|
||||
|
||||
f, err := st.Create(test_id, "img")
|
||||
if err != nil {
|
||||
|
@ -95,7 +95,7 @@ func TestCreate(t *testing.T) {
|
|||
|
||||
func TestDelete(t *testing.T) {
|
||||
st, err := Init(test_path)
|
||||
defer st.del()
|
||||
defer del()
|
||||
|
||||
_, err = st.Store(test_id, strings.NewReader(test_book), "epub")
|
||||
if err != nil {
|
||||
|
@ -111,3 +111,7 @@ func TestDelete(t *testing.T) {
|
|||
t.Fatal("Retrieve book without error.")
|
||||
}
|
||||
}
|
||||
|
||||
func del() {
|
||||
os.RemoveAll(test_path)
|
||||
}
|
||||
|
|
Reference in a new issue