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:
39
api/domain_ownership_verify_test.go
Normal file
39
api/domain_ownership_verify_test.go
Normal file
@@ -0,0 +1,39 @@
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user