a090770b73
I know this is a huge commit, but I can't be bothered to check this in part by part.
40 lines
851 B
Go
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
|
|
}
|
|
}
|