21 lines
340 B
Go
Executable File
21 lines
340 B
Go
Executable File
package notes
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"local/notes-server/config"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestDelete(t *testing.T) {
|
|
config.Root = "/tmp"
|
|
ioutil.WriteFile("/tmp/a", []byte("hi"), os.ModePerm)
|
|
n := &Notes{}
|
|
if err := n.Delete("/notes/a"); err != nil {
|
|
t.Error(err)
|
|
}
|
|
if _, err := os.Stat("/tmp/a"); err == nil {
|
|
t.Error(err)
|
|
}
|
|
}
|