UserStore migration (#15563)
* Migration completed * Fix tests * Fix tests * Fix tests * Suggestions * Trigger CI * Suggestions * Merge with master * Trigger CI Co-authored-by: Mattermod <mattermod@users.noreply.github.com> Co-authored-by: Agniva De Sarker <agnivade@yahoo.co.in>
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
d51d843fcd
Коммит
96f1739f8f
@@ -44,13 +44,13 @@ func TestCreateUser(t *testing.T) {
|
||||
ruser.Username = GenerateTestUsername()
|
||||
ruser.Password = "passwd1"
|
||||
_, resp = th.Client.CreateUser(ruser)
|
||||
CheckErrorMessage(t, resp, "store.sql_user.save.email_exists.app_error")
|
||||
CheckErrorMessage(t, resp, "app.user.save.existing.app_error")
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
ruser.Email = th.GenerateTestEmail()
|
||||
ruser.Username = user.Username
|
||||
_, resp = th.Client.CreateUser(ruser)
|
||||
CheckErrorMessage(t, resp, "store.sql_user.save.username_exists.app_error")
|
||||
CheckErrorMessage(t, resp, "app.user.save.existing.app_error")
|
||||
CheckBadRequestStatus(t, resp)
|
||||
|
||||
ruser.Email = ""
|
||||
@@ -1996,8 +1996,8 @@ func TestPermanentDeleteAllUsers(t *testing.T) {
|
||||
require.Nil(t, err)
|
||||
|
||||
// Check that we have users and posts in the database
|
||||
users, err := th.App.Srv().Store.User().GetAll()
|
||||
require.Nil(t, err)
|
||||
users, nErr := th.App.Srv().Store.User().GetAll()
|
||||
require.Nil(t, nErr)
|
||||
require.Greater(t, len(users), 0)
|
||||
|
||||
postCount, nErr := th.App.Srv().Store.Post().AnalyticsPostCount("", false, false)
|
||||
@@ -2009,8 +2009,8 @@ func TestPermanentDeleteAllUsers(t *testing.T) {
|
||||
require.Nil(t, resp.Error)
|
||||
|
||||
// Check that both user and post tables are empty
|
||||
users, err = th.App.Srv().Store.User().GetAll()
|
||||
require.Nil(t, err)
|
||||
users, nErr = th.App.Srv().Store.User().GetAll()
|
||||
require.Nil(t, nErr)
|
||||
require.Len(t, users, 0)
|
||||
|
||||
postCount, nErr = th.App.Srv().Store.Post().AnalyticsPostCount("", false, false)
|
||||
@@ -2673,14 +2673,14 @@ func TestUserLoginMFAFlow(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
|
||||
// Fake user has MFA enabled
|
||||
err = th.Server.Store.User().UpdateMfaActive(th.BasicUser.Id, true)
|
||||
require.Nil(t, err)
|
||||
nErr := th.Server.Store.User().UpdateMfaActive(th.BasicUser.Id, true)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
err = th.Server.Store.User().UpdateMfaActive(th.BasicUser.Id, true)
|
||||
require.Nil(t, err)
|
||||
nErr = th.Server.Store.User().UpdateMfaActive(th.BasicUser.Id, true)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
err = th.Server.Store.User().UpdateMfaSecret(th.BasicUser.Id, secret.Secret)
|
||||
require.Nil(t, err)
|
||||
nErr = th.Server.Store.User().UpdateMfaSecret(th.BasicUser.Id, secret.Secret)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
user, resp := th.Client.Login(th.BasicUser.Email, th.BasicUser.Password)
|
||||
CheckErrorMessage(t, resp, "mfa.validate_token.authenticate.app_error")
|
||||
@@ -2706,11 +2706,11 @@ func TestUserLoginMFAFlow(t *testing.T) {
|
||||
assert.Nil(t, err)
|
||||
|
||||
// Fake user has MFA enabled
|
||||
err = th.Server.Store.User().UpdateMfaActive(th.BasicUser.Id, true)
|
||||
require.Nil(t, err)
|
||||
nErr := th.Server.Store.User().UpdateMfaActive(th.BasicUser.Id, true)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
err = th.Server.Store.User().UpdateMfaSecret(th.BasicUser.Id, secret.Secret)
|
||||
require.Nil(t, err)
|
||||
nErr = th.Server.Store.User().UpdateMfaSecret(th.BasicUser.Id, secret.Secret)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
code := dgoogauth.ComputeCode(secret.Secret, time.Now().UTC().Unix()/30)
|
||||
|
||||
|
||||
@@ -79,7 +79,7 @@ func TestApiResctrictedViewMembers(t *testing.T) {
|
||||
"Get not existing user without restrictions",
|
||||
"",
|
||||
model.NewId(),
|
||||
"store.sql_user.missing_account.const",
|
||||
"app.user.missing_account.const",
|
||||
},
|
||||
{
|
||||
"Get not existing user with restrictions to teams",
|
||||
@@ -161,7 +161,7 @@ func TestApiResctrictedViewMembers(t *testing.T) {
|
||||
"Get not existing user without restrictions",
|
||||
"",
|
||||
model.NewId(),
|
||||
"store.sql_user.get_by_username.app_error",
|
||||
"app.user.get_by_username.app_error",
|
||||
},
|
||||
{
|
||||
"Get not existing user with restrictions to teams",
|
||||
@@ -243,7 +243,7 @@ func TestApiResctrictedViewMembers(t *testing.T) {
|
||||
"Get not existing user without restrictions",
|
||||
"",
|
||||
th.GenerateTestEmail(),
|
||||
"store.sql_user.missing_account.const",
|
||||
"app.user.missing_account.const",
|
||||
},
|
||||
{
|
||||
"Get not existing user with restrictions to teams",
|
||||
@@ -325,7 +325,7 @@ func TestApiResctrictedViewMembers(t *testing.T) {
|
||||
"Get not existing user without restrictions",
|
||||
"",
|
||||
model.NewId(),
|
||||
"store.sql_user.missing_account.const",
|
||||
"app.user.missing_account.const",
|
||||
},
|
||||
{
|
||||
"Get not existing user with restrictions to teams",
|
||||
@@ -407,7 +407,7 @@ func TestApiResctrictedViewMembers(t *testing.T) {
|
||||
"Get not existing user without restrictions",
|
||||
"",
|
||||
model.NewId(),
|
||||
"store.sql_user.missing_account.const",
|
||||
"app.user.missing_account.const",
|
||||
},
|
||||
{
|
||||
"Get not existing user with restrictions to teams",
|
||||
|
||||
@@ -264,14 +264,14 @@ func TestWebSocketStatuses(t *testing.T) {
|
||||
user := model.User{Email: strings.ToLower(model.NewId()) + "success+test@simulator.amazonses.com", Nickname: "Corey Hulen", Password: "passwd1"}
|
||||
ruser := Client.Must(Client.CreateUser(&user)).(*model.User)
|
||||
th.LinkUserToTeam(ruser, rteam)
|
||||
_, err = th.App.Srv().Store.User().VerifyEmail(ruser.Id, ruser.Email)
|
||||
require.Nil(t, err)
|
||||
_, nErr := th.App.Srv().Store.User().VerifyEmail(ruser.Id, ruser.Email)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
user2 := model.User{Email: strings.ToLower(model.NewId()) + "success+test@simulator.amazonses.com", Nickname: "Corey Hulen", Password: "passwd1"}
|
||||
ruser2 := Client.Must(Client.CreateUser(&user2)).(*model.User)
|
||||
th.LinkUserToTeam(ruser2, rteam)
|
||||
_, err = th.App.Srv().Store.User().VerifyEmail(ruser2.Id, ruser2.Email)
|
||||
require.Nil(t, err)
|
||||
_, nErr = th.App.Srv().Store.User().VerifyEmail(ruser2.Id, ruser2.Email)
|
||||
require.Nil(t, nErr)
|
||||
|
||||
Client.Login(user.Email, user.Password)
|
||||
|
||||
|
||||
Ссылка в новой задаче
Block a user