@@ -359,7 +359,11 @@ func (s *UserSuite) Test_UpdateUserByID_UnknownUser() {
359359}
360360
361361func (s * UserSuite ) Test_UpdateUserByID_UpdateNotPassword () {
362- s .db .CreateUser (& model.User {ID : 2 , Name : "nico" , Pass : password .CreatePassword ("old" , 5 )})
362+ pw , err := password .CreatePassword ("old" , 5 )
363+ if err != nil {
364+ s .T ().Fatalf ("Failed to create password: %v" , err )
365+ }
366+ s .db .CreateUser (& model.User {ID : 2 , Name : "nico" , Pass : pw })
363367
364368 s .ctx .Params = gin.Params {{Key : "id" , Value : "2" }}
365369
@@ -376,7 +380,11 @@ func (s *UserSuite) Test_UpdateUserByID_UpdateNotPassword() {
376380}
377381
378382func (s * UserSuite ) Test_UpdateUserByID_UpdatePassword () {
379- s .db .CreateUser (& model.User {ID : 2 , Name : "tom" , Pass : password .CreatePassword ("old" , 5 )})
383+ pw , err := password .CreatePassword ("old" , 5 )
384+ if err != nil {
385+ s .T ().Fatalf ("Failed to create password: %v" , err )
386+ }
387+ s .db .CreateUser (& model.User {ID : 2 , Name : "tom" , Pass : pw })
380388
381389 s .ctx .Params = gin.Params {{Key : "id" , Value : "2" }}
382390
@@ -413,7 +421,11 @@ func (s *UserSuite) Test_UpdateUserByID_PreservesOIDCID() {
413421}
414422
415423func (s * UserSuite ) Test_UpdatePassword () {
416- s .db .CreateUser (& model.User {ID : 1 , Name : "jmattheis" , Pass : password .CreatePassword ("old" , 5 )})
424+ pw , err := password .CreatePassword ("old" , 5 )
425+ if err != nil {
426+ s .T ().Fatalf ("Failed to create password: %v" , err )
427+ }
428+ s .db .CreateUser (& model.User {ID : 1 , Name : "jmattheis" , Pass : pw })
417429
418430 test .WithUser (s .ctx , 1 )
419431 s .ctx .Request = httptest .NewRequest ("POST" , "/user/current/password" , strings .NewReader (`{"pass": "new"}` ))
@@ -429,7 +441,11 @@ func (s *UserSuite) Test_UpdatePassword() {
429441}
430442
431443func (s * UserSuite ) Test_UpdatePassword_EmptyPassword () {
432- s .db .CreateUser (& model.User {ID : 1 , Name : "jmattheis" , Pass : password .CreatePassword ("old" , 5 )})
444+ pw , err := password .CreatePassword ("old" , 5 )
445+ if err != nil {
446+ s .T ().Fatalf ("Failed to create password: %v" , err )
447+ }
448+ s .db .CreateUser (& model.User {ID : 1 , Name : "jmattheis" , Pass : pw })
433449
434450 test .WithUser (s .ctx , 1 )
435451 s .ctx .Request = httptest .NewRequest ("POST" , "/user/current/password" , strings .NewReader (`{"pass":""}` ))
0 commit comments