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:
Adhityaa
2018-05-27 20:10:42 +05:30
parent 60e7e59841
commit a090770b73
95 changed files with 4203 additions and 0 deletions

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