MM-61032: Add default_team_id to accept invite flow (#28841)
* add default_team_id to accept invite api * add team selector to accept invite flow UI * e2e * lint/i18n
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
5a923e0b94
Коммит
fcded9559c
@@ -295,9 +295,10 @@ func TestCreateRemoteCluster(t *testing.T) {
|
||||
|
||||
func TestRemoteClusterAcceptinvite(t *testing.T) {
|
||||
rcAcceptInvite := &model.RemoteClusterAcceptInvite{
|
||||
Name: "remotecluster",
|
||||
Invite: "myinvitecode",
|
||||
Password: "mysupersecret",
|
||||
Name: "remotecluster",
|
||||
Invite: "myinvitecode",
|
||||
Password: "mysupersecret",
|
||||
DefaultTeamId: "",
|
||||
}
|
||||
|
||||
t.Run("Should not work if the remote cluster service is not enabled", func(t *testing.T) {
|
||||
@@ -313,6 +314,8 @@ func TestRemoteClusterAcceptinvite(t *testing.T) {
|
||||
th := setupForSharedChannels(t).InitBasic()
|
||||
defer th.TearDown()
|
||||
|
||||
rcAcceptInvite.DefaultTeamId = th.BasicTeam.Id
|
||||
|
||||
remoteId := model.NewId()
|
||||
invite := &model.RemoteClusterInvite{
|
||||
RemoteId: remoteId,
|
||||
@@ -335,7 +338,7 @@ func TestRemoteClusterAcceptinvite(t *testing.T) {
|
||||
|
||||
th.App.UpdateConfig(func(cfg *model.Config) { *cfg.ServiceSettings.SiteURL = "http://localhost:8065" })
|
||||
|
||||
t.Run("should fail if the parameters are not valid", func(t *testing.T) {
|
||||
t.Run("should fail if the name parameter is not valid", func(t *testing.T) {
|
||||
rcAcceptInvite.Name = ""
|
||||
defer func() { rcAcceptInvite.Name = "remotecluster" }()
|
||||
|
||||
@@ -345,6 +348,26 @@ func TestRemoteClusterAcceptinvite(t *testing.T) {
|
||||
require.Empty(t, rc)
|
||||
})
|
||||
|
||||
t.Run("should fail if the default team parameter is empty", func(t *testing.T) {
|
||||
rcAcceptInvite.DefaultTeamId = ""
|
||||
defer func() { rcAcceptInvite.DefaultTeamId = th.BasicTeam.Id }()
|
||||
|
||||
rc, resp, err := th.SystemAdminClient.RemoteClusterAcceptInvite(context.Background(), rcAcceptInvite)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
require.Error(t, err)
|
||||
require.Empty(t, rc)
|
||||
})
|
||||
|
||||
t.Run("should fail if the default team provided doesn't exist", func(t *testing.T) {
|
||||
rcAcceptInvite.DefaultTeamId = model.NewId()
|
||||
defer func() { rcAcceptInvite.DefaultTeamId = th.BasicTeam.Id }()
|
||||
|
||||
rc, resp, err := th.SystemAdminClient.RemoteClusterAcceptInvite(context.Background(), rcAcceptInvite)
|
||||
CheckBadRequestStatus(t, resp)
|
||||
require.Error(t, err)
|
||||
require.Empty(t, rc)
|
||||
})
|
||||
|
||||
t.Run("should fail with the correct status code if the invite returns an app error", func(t *testing.T) {
|
||||
rcAcceptInvite.Invite = "malformedinvite"
|
||||
// reset the invite after
|
||||
|
||||
Ссылка в новой задаче
Block a user