This commit is contained in:
Alex
2025-03-24 17:46:11 +01:00
parent 5d55f5a8d9
commit 560623788a
4 changed files with 74 additions and 62 deletions

View File

@@ -31,8 +31,10 @@ func setupTestContext() (*TestContext, error) {
testEmail := "john.doe@example.com"
user, err := Uc.Service.FromEmail(&testEmail)
if err != nil {
logger.Error.Printf("error fetching user: %#v", err)
return nil, err
}
logger.Error.Printf("found user: %#v", user)
return &TestContext{
router: gin.Default(),
response: httptest.NewRecorder(),
@@ -60,7 +62,6 @@ func testCreatePasswordHandler(t *testing.T) {
req, _ := http.NewRequest("POST", "/password", bytes.NewBuffer(body))
req.AddCookie(AdminCookie)
tc.router.ServeHTTP(tc.response, req)
logger.Error.Printf("Test results for %#v", t.Name())
assert.Equal(t, http.StatusAccepted, tc.response.Code)
assert.JSONEq(t, `{"message":"password_change_requested"}`, tc.response.Body.String())
err = checkEmailDelivery(tc.user, true)