mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-15 02:45:22 +00:00
test(cli): admin user change-password --must-change-password
(cherry picked from commit b9424e634f
)
This commit is contained in:
parent
8b4ca4501a
commit
21a853aac7
|
@ -53,6 +53,14 @@ func Test_Cmd_AdminUser(t *testing.T) {
|
||||||
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: name})
|
user := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: name})
|
||||||
assert.Equal(t, testCase.mustChangePassword, user.MustChangePassword)
|
assert.Equal(t, testCase.mustChangePassword, user.MustChangePassword)
|
||||||
|
|
||||||
|
options = []string{"user", "change-password", "--username", name, "--password", "password"}
|
||||||
|
options = append(options, testCase.options...)
|
||||||
|
output, err = runMainApp("admin", options...)
|
||||||
|
assert.NoError(t, err)
|
||||||
|
assert.Contains(t, output, "has been successfully updated")
|
||||||
|
user = unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: name})
|
||||||
|
assert.Equal(t, testCase.mustChangePassword, user.MustChangePassword)
|
||||||
|
|
||||||
_, err = runMainApp("admin", "user", "delete", "--username", name)
|
_, err = runMainApp("admin", "user", "delete", "--username", name)
|
||||||
assert.NoError(t, err)
|
assert.NoError(t, err)
|
||||||
unittest.AssertNotExistsBean(t, &user_model.User{Name: name})
|
unittest.AssertNotExistsBean(t, &user_model.User{Name: name})
|
||||||
|
|
Loading…
Reference in a new issue