add first exiting test

This commit is contained in:
sentriz
2019-05-24 15:23:50 +01:00
parent 6cb40b8d57
commit a91ef24139
3 changed files with 67 additions and 35 deletions

No files matched your search

+27
View File
@@ -0,0 +1,27 @@
package handler
import "fmt"
func validateUsername(username string) error {
if username == "" {
return fmt.Errorf("please enter the username")
}
return nil
}
func validatePasswords(pOne, pTwo string) error {
if pOne == "" || pTwo == "" {
return fmt.Errorf("please enter the password twice")
}
if !(pOne == pTwo) {
return fmt.Errorf("the two passwords entered were not the same")
}
return nil
}
func validateAPIKey(apiKey, secret string) error {
if apiKey == "" || secret == "" {
return fmt.Errorf("please enter both the api key and secret")
}
return nil
}