fix web/handlers tests

used the route name in palce of the url
This commit is contained in:
Henry 2021-02-09 17:35:17 +01:00
parent 2f907a1753
commit 34aa8dd2c4
2 changed files with 6 additions and 4 deletions

View File

@ -64,7 +64,6 @@ func New(
v, err := a.AuthenticateRequest(r) v, err := a.AuthenticateRequest(r)
if err != nil { if err != nil {
fmt.Println(err)
return no return no
} }
uid, ok := v.(int64) uid, ok := v.(int64)

View File

@ -80,10 +80,13 @@ func TestRestricted(t *testing.T) {
func TestLoginForm(t *testing.T) { func TestLoginForm(t *testing.T) {
setup(t) setup(t)
t.Cleanup(teardown) t.Cleanup(teardown)
a := assert.New(t) a, r := assert.New(t), require.New(t)
html, resp := testClient.GetHTML(router.AuthFallbackSignInForm, nil) url, err := testRouter.Get(router.AuthFallbackSignInForm).URL()
r.Nil(err)
html, resp := testClient.GetHTML(url.String(), nil)
a.Equal(http.StatusOK, resp.Code, "wrong HTTP status code") a.Equal(http.StatusOK, resp.Code, "wrong HTTP status code")
found := html.Find("title").Text() found := html.Find("title").Text()
a.Equal("Login Form", found) a.Equal("fallback sign-in", found)
} }