-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor: removed user login register code
- Loading branch information
1 parent
f2b54b8
commit 70467de
Showing
9 changed files
with
0 additions
and
283 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -361,18 +361,12 @@ func (th *TestHelper) Start() *TestHelper { | |
func (th *TestHelper) InitBasic() *TestHelper { | ||
th.Start() | ||
|
||
// user1 | ||
th.RegisterAndLogin(th.Client, user1Username, "[email protected]", password, "") | ||
|
||
// get token | ||
team, resp := th.Client.GetTeam(model.GlobalTeamID) | ||
th.CheckOK(resp) | ||
require.NotNil(th.T, team) | ||
require.NotNil(th.T, team.SignupToken) | ||
|
||
// user2 | ||
th.RegisterAndLogin(th.Client2, user2Username, "[email protected]", password, team.SignupToken) | ||
|
||
return th | ||
} | ||
|
||
|
@@ -399,44 +393,6 @@ func (th *TestHelper) TearDown() { | |
} | ||
} | ||
|
||
func (th *TestHelper) RegisterAndLogin(client *client.Client, username, email, password, token string) { | ||
req := &model.RegisterRequest{ | ||
Username: username, | ||
Email: email, | ||
Password: password, | ||
Token: token, | ||
} | ||
|
||
success, resp := th.Client.Register(req) | ||
th.CheckOK(resp) | ||
require.True(th.T, success) | ||
|
||
th.Login(client, username, password) | ||
} | ||
|
||
func (th *TestHelper) Login(client *client.Client, username, password string) { | ||
req := &model.LoginRequest{ | ||
Type: "normal", | ||
Username: username, | ||
Password: password, | ||
} | ||
data, resp := client.Login(req) | ||
th.CheckOK(resp) | ||
require.NotNil(th.T, data) | ||
} | ||
|
||
func (th *TestHelper) Login1() { | ||
th.Login(th.Client, user1Username, password) | ||
} | ||
|
||
func (th *TestHelper) Login2() { | ||
th.Login(th.Client2, user2Username, password) | ||
} | ||
|
||
func (th *TestHelper) Logout(client *client.Client) { | ||
client.Token = "" | ||
} | ||
|
||
func (th *TestHelper) Me(client *client.Client) *model.User { | ||
user, resp := client.GetMe() | ||
th.CheckOK(resp) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -91,7 +91,6 @@ func setupClients(th *TestHelper) Clients { | |
|
||
func setupLocalClients(th *TestHelper) Clients { | ||
th.Client = client.NewClient(th.Server.Config().ServerRoot, "") | ||
th.RegisterAndLogin(th.Client, "sysadmin", "[email protected]", password, "") | ||
|
||
clients := Clients{ | ||
Anon: client.NewClient(th.Server.Config().ServerRoot, ""), | ||
|
@@ -109,23 +108,11 @@ func setupLocalClients(th *TestHelper) Clients { | |
th.CheckOK(resp) | ||
require.NotNil(th.T, team) | ||
require.NotNil(th.T, team.SignupToken) | ||
|
||
th.RegisterAndLogin(clients.NoTeamMember, userNoTeamMember, userNoTeamMember+"@sample.com", password, team.SignupToken) | ||
userNoTeamMemberID = clients.NoTeamMember.GetUserID() | ||
|
||
th.RegisterAndLogin(clients.TeamMember, userTeamMember, userTeamMember+"@sample.com", password, team.SignupToken) | ||
userTeamMemberID = clients.TeamMember.GetUserID() | ||
|
||
th.RegisterAndLogin(clients.Viewer, userViewer, userViewer+"@sample.com", password, team.SignupToken) | ||
userViewerID = clients.Viewer.GetUserID() | ||
|
||
th.RegisterAndLogin(clients.Commenter, userCommenter, userCommenter+"@sample.com", password, team.SignupToken) | ||
userCommenterID = clients.Commenter.GetUserID() | ||
|
||
th.RegisterAndLogin(clients.Editor, userEditor, userEditor+"@sample.com", password, team.SignupToken) | ||
userEditorID = clients.Editor.GetUserID() | ||
|
||
th.RegisterAndLogin(clients.Admin, userAdmin, userAdmin+"@sample.com", password, team.SignupToken) | ||
userAdminID = clients.Admin.GetUserID() | ||
|
||
return clients | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.