@@ -14,6 +14,7 @@ import (
1414 "github.com/gotify/server/v2/test"
1515 "github.com/gotify/server/v2/test/testdb"
1616 "github.com/stretchr/testify/assert"
17+ "github.com/stretchr/testify/require"
1718 "github.com/stretchr/testify/suite"
1819)
1920
@@ -359,7 +360,9 @@ func (s *UserSuite) Test_UpdateUserByID_UnknownUser() {
359360}
360361
361362func (s * UserSuite ) Test_UpdateUserByID_UpdateNotPassword () {
362- s .db .CreateUser (& model.User {ID : 2 , Name : "nico" , Pass : password .CreatePassword ("old" , 5 )})
363+ pw , err := password .CreatePassword ("old" , 5 )
364+ require .NoError (s .T (), err )
365+ s .db .CreateUser (& model.User {ID : 2 , Name : "nico" , Pass : pw })
363366
364367 s .ctx .Params = gin.Params {{Key : "id" , Value : "2" }}
365368
@@ -376,7 +379,9 @@ func (s *UserSuite) Test_UpdateUserByID_UpdateNotPassword() {
376379}
377380
378381func (s * UserSuite ) Test_UpdateUserByID_UpdatePassword () {
379- s .db .CreateUser (& model.User {ID : 2 , Name : "tom" , Pass : password .CreatePassword ("old" , 5 )})
382+ pw , err := password .CreatePassword ("old" , 5 )
383+ require .NoError (s .T (), err )
384+ s .db .CreateUser (& model.User {ID : 2 , Name : "tom" , Pass : pw })
380385
381386 s .ctx .Params = gin.Params {{Key : "id" , Value : "2" }}
382387
@@ -413,7 +418,9 @@ func (s *UserSuite) Test_UpdateUserByID_PreservesOIDCID() {
413418}
414419
415420func (s * UserSuite ) Test_UpdatePassword () {
416- s .db .CreateUser (& model.User {ID : 1 , Name : "jmattheis" , Pass : password .CreatePassword ("old" , 5 )})
421+ pw , err := password .CreatePassword ("old" , 5 )
422+ require .NoError (s .T (), err )
423+ s .db .CreateUser (& model.User {ID : 1 , Name : "jmattheis" , Pass : pw })
417424
418425 test .WithUser (s .ctx , 1 )
419426 s .ctx .Request = httptest .NewRequest ("POST" , "/user/current/password" , strings .NewReader (`{"pass": "new"}` ))
@@ -429,7 +436,9 @@ func (s *UserSuite) Test_UpdatePassword() {
429436}
430437
431438func (s * UserSuite ) Test_UpdatePassword_EmptyPassword () {
432- s .db .CreateUser (& model.User {ID : 1 , Name : "jmattheis" , Pass : password .CreatePassword ("old" , 5 )})
439+ pw , err := password .CreatePassword ("old" , 5 )
440+ require .NoError (s .T (), err )
441+ s .db .CreateUser (& model.User {ID : 1 , Name : "jmattheis" , Pass : pw })
433442
434443 test .WithUser (s .ctx , 1 )
435444 s .ctx .Request = httptest .NewRequest ("POST" , "/user/current/password" , strings .NewReader (`{"pass":""}` ))
0 commit comments