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:
33
api/domain_list_test.go
Normal file
33
api/domain_list_test.go
Normal file
@ -0,0 +1,33 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func TestDomainListBasics(t *testing.T) {
|
||||
failTestOnError(t, setupTestEnv())
|
||||
|
||||
domainNew("temp-owner-hex", "Example", "example.com")
|
||||
domainNew("temp-owner-hex", "Example", "example2.com")
|
||||
|
||||
d, err := domainList("temp-owner-hex")
|
||||
if err != nil {
|
||||
t.Errorf("unexpected error listing domains: %v", err)
|
||||
return
|
||||
}
|
||||
|
||||
if len(d) != 2 {
|
||||
t.Errorf("expected number of domains to be 2 got %d", len(d))
|
||||
return
|
||||
}
|
||||
|
||||
if d[0].Domain != "example.com" {
|
||||
t.Errorf("expected first domain to be example.com got %s", d[0].Domain)
|
||||
return
|
||||
}
|
||||
|
||||
if d[1].Domain != "example2.com" {
|
||||
t.Errorf("expected first domain to be example2.com got %s", d[1].Domain)
|
||||
return
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user