chore: convert calls to t.fatal to testify (#12506)
- use require testfify assertions to replace calls to t.fatal
Этот коммит содержится в:
коммит произвёл
Miguel de la Cruz
родитель
0186fdf9e7
Коммит
714a5c3c29
@@ -33,9 +33,7 @@ func TestCreateUserWithTeam(t *testing.T) {
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if !found {
|
require.True(t, found, "Failed to create User")
|
||||||
t.Fatal("Failed to create User")
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCreateUserWithoutTeam(t *testing.T) {
|
func TestCreateUserWithoutTeam(t *testing.T) {
|
||||||
@@ -48,11 +46,10 @@ func TestCreateUserWithoutTeam(t *testing.T) {
|
|||||||
|
|
||||||
th.CheckCommand(t, "user", "create", "--email", email, "--password", "mypassword1", "--username", username)
|
th.CheckCommand(t, "user", "create", "--email", email, "--password", "mypassword1", "--username", username)
|
||||||
|
|
||||||
if user, err := th.App.Srv.Store.User().GetByEmail(email); err != nil {
|
user, err := th.App.Srv.Store.User().GetByEmail(email)
|
||||||
t.Fatal(err)
|
require.Nil(t, err)
|
||||||
} else {
|
|
||||||
require.Equal(t, email, user.Email)
|
require.Equal(t, email, user.Email)
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestResetPassword(t *testing.T) {
|
func TestResetPassword(t *testing.T) {
|
||||||
@@ -84,16 +81,14 @@ func TestChangeUserEmail(t *testing.T) {
|
|||||||
newEmail := model.NewId() + "@mattermost-test.com"
|
newEmail := model.NewId() + "@mattermost-test.com"
|
||||||
|
|
||||||
th.CheckCommand(t, "user", "email", th.BasicUser.Username, newEmail)
|
th.CheckCommand(t, "user", "email", th.BasicUser.Username, newEmail)
|
||||||
if _, err := th.App.Srv.Store.User().GetByEmail(th.BasicUser.Email); err == nil {
|
_, err := th.App.Srv.Store.User().GetByEmail(th.BasicUser.Email)
|
||||||
t.Fatal("should've updated to the new email")
|
require.NotNil(t, err, "should've updated to the new email")
|
||||||
}
|
|
||||||
if user, err := th.App.Srv.Store.User().GetByEmail(newEmail); err != nil {
|
user, err := th.App.Srv.Store.User().GetByEmail(newEmail)
|
||||||
t.Fatal(err)
|
require.Nil(t, err)
|
||||||
} else {
|
|
||||||
if user.Email != newEmail {
|
require.Equal(t, user.Email, newEmail, "should've updated to the new email")
|
||||||
t.Fatal("should've updated to the new email")
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// should fail because using an invalid email
|
// should fail because using an invalid email
|
||||||
require.Error(t, th.RunCommand(t, "user", "email", th.BasicUser.Username, "wrong$email.com"))
|
require.Error(t, th.RunCommand(t, "user", "email", th.BasicUser.Username, "wrong$email.com"))
|
||||||
|
|||||||
Ссылка в новой задаче
Block a user