You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
32 lines
563 B
32 lines
563 B
package auth
|
|
|
|
import (
|
|
"net/http"
|
|
"net/url"
|
|
"strings"
|
|
"testing"
|
|
)
|
|
|
|
type handlerStruct struct{}
|
|
|
|
func (hs *handlerStruct) ServeHTTP(w http.ResponseWriter, req *http.Request) {
|
|
req.ParseForm() // Router does this in non-tests
|
|
|
|
if strings.HasPrefix(req.URL.Path, "/auth") {
|
|
Handler.Handle("/auth", w, req, nil)
|
|
return
|
|
}
|
|
}
|
|
|
|
func TestHandler(t *testing.T) {
|
|
auther := testAuther{FullName: "Test"}
|
|
Register(&auther)
|
|
|
|
form := url.Values{}
|
|
form.Set("username", "Test")
|
|
form.Set("password", "stuff'nthings")
|
|
|
|
t.Run("Register", func(t *testing.T) {
|
|
|
|
})
|
|
}
|