commento/api/domain_list_test.go
Adhityaa a090770b73 api: Add go files
I know this is a huge commit, but I can't be bothered to check
this in part by part.
2018-05-27 23:40:46 +05:30

34 lines
696 B
Go

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
}
}