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:
32
api/owner_self_test.go
Normal file
32
api/owner_self_test.go
Normal file
@ -0,0 +1,32 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestOwnerSelfBasics(t *testing.T) {
|
||||
failTestOnError(t, setupTestEnv())
|
||||
|
||||
ownerNew("test@example.com", "Test", "hunter2")
|
||||
session, _ := ownerLogin("test@example.com", "hunter2")
|
||||
|
||||
loggedIn, o := ownerSelf(session)
|
||||
if !loggedIn {
|
||||
t.Errorf("expected loggedIn=true got loggedIn=false")
|
||||
return
|
||||
}
|
||||
|
||||
if o.Name != "Test" {
|
||||
t.Errorf("expected name=Test got name=%s", o.Name)
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
func TestOwnerSelfNotLoggedIn(t *testing.T) {
|
||||
failTestOnError(t, setupTestEnv())
|
||||
|
||||
if loggedIn, _ := ownerSelf("does-not-exist"); loggedIn {
|
||||
t.Errorf("expected loggedIn=false got loggedIn=true")
|
||||
return
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user