23 lines
448 B
Go
Executable File
23 lines
448 B
Go
Executable File
package notes
|
|
|
|
import (
|
|
"io/ioutil"
|
|
"gitea.inhome.blapointe.com/local/notes-server/config"
|
|
"os"
|
|
"testing"
|
|
)
|
|
|
|
func TestSubmit(t *testing.T) {
|
|
config.Root = "/tmp"
|
|
n := &Notes{}
|
|
if err := n.Submit("/submit/a", "a"); err != nil {
|
|
t.Error(err)
|
|
} else if b, err := ioutil.ReadFile("/tmp/a"); err != nil {
|
|
t.Error(err)
|
|
} else if string(b) != "a" {
|
|
t.Error(string(b))
|
|
} else if err := os.Remove("/tmp/a"); err != nil {
|
|
t.Error(err)
|
|
}
|
|
}
|