notes-server/notes/edit_test.go

22 lines
399 B
Go
Executable File

package notes
import (
"gitea.inhome.blapointe.com/local/notes-server/config"
"strings"
"testing"
)
func TestEdit(t *testing.T) {
config.Root = "/tmp"
n := &Notes{}
if body, err := n.Edit("/notes/a"); err != nil {
t.Error(err)
} else if !strings.Contains(body, "/submit/a") {
t.Error(body)
}
config.Root = "/usr"
if _, err := n.Edit("/notes/local"); err == nil {
t.Error(err)
}
}