()
| 409 | } |
| 410 | |
| 411 | func (s *UserSuite) Test_UpdatePassword_EmptyPassword() { |
| 412 | s.db.CreateUser(&model.User{ID: 1, Name: "jmattheis", Pass: password.CreatePassword("old", 5)}) |
| 413 | |
| 414 | test.WithUser(s.ctx, 1) |
| 415 | s.ctx.Request = httptest.NewRequest("POST", "/user/current/password", strings.NewReader(`{"pass":""}`)) |
| 416 | s.ctx.Request.Header.Set("Content-Type", "application/json") |
| 417 | |
| 418 | s.a.ChangePassword(s.ctx) |
| 419 | |
| 420 | assert.Equal(s.T(), 400, s.recorder.Code) |
| 421 | user, err := s.db.GetUserByID(1) |
| 422 | assert.NoError(s.T(), err) |
| 423 | assert.NotNil(s.T(), user) |
| 424 | assert.True(s.T(), password.ComparePassword(user.Pass, []byte("old"))) |
| 425 | } |
| 426 | |
| 427 | func (s *UserSuite) loginAdmin() { |
| 428 | s.db.CreateUser(&model.User{ID: 1, Name: "admin", Admin: true}) |
nothing calls this directly
no test coverage detected