mirror of
https://gitlab.com/commento/commento.git
synced 2025-06-29 22:56:37 -04:00
api: Add go files
I know this is a huge commit, but I can't be bothered to check this in part by part.
This commit is contained in:
34
api/comment_delete_test.go
Normal file
34
api/comment_delete_test.go
Normal file
@ -0,0 +1,34 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
"time"
|
||||
)
|
||||
|
||||
func TestCommentDeleteBasics(t *testing.T) {
|
||||
failTestOnError(t, setupTestEnv())
|
||||
|
||||
commentHex, _ := commentNew("temp-commenter-hex", "example.com", "/path.html", "root", "**foo**", "approved", time.Now().UTC())
|
||||
commentNew("temp-commenter-hex", "example.com", "/path.html", commentHex, "**bar**", "approved", time.Now().UTC())
|
||||
|
||||
if err := commentDelete(commentHex); err != nil {
|
||||
t.Errorf("unexpected error deleting comment: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
c, _, _ := commentList("temp-commenter-hex", "example.com", "/path.html", false)
|
||||
|
||||
if len(c) != 0 {
|
||||
t.Errorf("expected no comments found %d comments", len(c))
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func TestCommentDeleteEmpty(t *testing.T) {
|
||||
failTestOnError(t, setupTestEnv())
|
||||
|
||||
if err := commentDelete(""); err == nil {
|
||||
t.Errorf("expected error deleting comment with empty commentHex")
|
||||
return
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user