commento/api/domain_ownership_verify_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

40 lines
851 B
Go

package main
import (
"testing"
)
func TestDomainVerifyOwnershipBasics(t *testing.T) {
failTestOnError(t, setupTestEnv())
ownerHex, _ := ownerNew("test@example.com", "Test", "hunter2")
ownerLogin("test@example.com", "hunter2")
domainNew(ownerHex, "Example", "example.com")
isOwner, err := domainOwnershipVerify(ownerHex, "example.com")
if err != nil {
t.Errorf("error checking ownership: %v", err)
return
}
if !isOwner {
t.Errorf("expected isOwner=true got isOwner=false")
return
}
otherOwnerHex, _ := ownerNew("test2@example.com", "Test2", "hunter2")
ownerLogin("test2@example.com", "hunter2")
isOwner, err = domainOwnershipVerify(otherOwnerHex, "example.com")
if err != nil {
t.Errorf("error checking ownership: %v", err)
return
}
if isOwner {
t.Errorf("expected isOwner=false got isOwner=true")
return
}
}