This reverts commit 3ea75332e7.
Этот коммит содержится в:
коммит произвёл
GitHub
родитель
3a13987ee1
Коммит
e0efdd708b
@@ -1025,62 +1025,6 @@ func TestGetAllChannels(t *testing.T) {
|
||||
|
||||
_, resp := Client.GetAllChannels(0, 20, "")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
sysManagerChannels, resp := th.SystemManagerClient.GetAllChannels(0, 10000, "")
|
||||
CheckOKStatus(t, resp)
|
||||
policyChannel := (*sysManagerChannels)[0]
|
||||
policy, savePolicyErr := th.App.Srv().Store.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
|
||||
RetentionPolicy: model.RetentionPolicy{
|
||||
DisplayName: "Policy 1",
|
||||
PostDuration: model.NewInt64(30),
|
||||
},
|
||||
ChannelIDs: []string{policyChannel.Id},
|
||||
})
|
||||
require.NoError(t, savePolicyErr)
|
||||
|
||||
t.Run("exclude policy constrained", func(t *testing.T) {
|
||||
_, resp := th.SystemManagerClient.GetAllChannelsExcludePolicyConstrained(0, 10000, "")
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
channels, resp := th.SystemAdminClient.GetAllChannelsExcludePolicyConstrained(0, 10000, "")
|
||||
CheckOKStatus(t, resp)
|
||||
found := false
|
||||
for _, channel := range *channels {
|
||||
if channel.Id == policyChannel.Id {
|
||||
found = true
|
||||
break
|
||||
}
|
||||
}
|
||||
require.False(t, found)
|
||||
})
|
||||
|
||||
t.Run("does not return policy ID", func(t *testing.T) {
|
||||
channels, resp := th.SystemManagerClient.GetAllChannels(0, 10000, "")
|
||||
CheckOKStatus(t, resp)
|
||||
found := false
|
||||
for _, channel := range *channels {
|
||||
if channel.Id == policyChannel.Id {
|
||||
found = true
|
||||
require.Nil(t, channel.PolicyID)
|
||||
break
|
||||
}
|
||||
}
|
||||
require.True(t, found)
|
||||
})
|
||||
|
||||
t.Run("returns policy ID", func(t *testing.T) {
|
||||
channels, resp := th.SystemAdminClient.GetAllChannels(0, 10000, "")
|
||||
CheckOKStatus(t, resp)
|
||||
found := false
|
||||
for _, channel := range *channels {
|
||||
if channel.Id == policyChannel.Id {
|
||||
found = true
|
||||
require.Equal(t, *channel.PolicyID, policy.ID)
|
||||
break
|
||||
}
|
||||
}
|
||||
require.True(t, found)
|
||||
})
|
||||
}
|
||||
|
||||
func TestGetAllChannelsWithCount(t *testing.T) {
|
||||
@@ -1446,46 +1390,6 @@ func TestSearchAllChannels(t *testing.T) {
|
||||
|
||||
_, resp = Client.SearchAllChannels(&model.ChannelSearch{Term: ""})
|
||||
CheckForbiddenStatus(t, resp)
|
||||
|
||||
// Choose a policy which the system manager can read
|
||||
sysManagerChannels, resp := th.SystemManagerClient.GetAllChannels(0, 10000, "")
|
||||
CheckOKStatus(t, resp)
|
||||
policyChannel := (*sysManagerChannels)[0]
|
||||
policy, savePolicyErr := th.App.Srv().Store.RetentionPolicy().Save(&model.RetentionPolicyWithTeamAndChannelIDs{
|
||||
RetentionPolicy: model.RetentionPolicy{
|
||||
DisplayName: "Policy 1",
|
||||
PostDuration: model.NewInt64(30),
|
||||
},
|
||||
ChannelIDs: []string{policyChannel.Id},
|
||||
})
|
||||
require.NoError(t, savePolicyErr)
|
||||
|
||||
t.Run("does not return policy ID", func(t *testing.T) {
|
||||
channels, resp := th.SystemManagerClient.SearchAllChannels(&model.ChannelSearch{Term: policyChannel.Name})
|
||||
CheckOKStatus(t, resp)
|
||||
found := false
|
||||
for _, channel := range *channels {
|
||||
if channel.Id == policyChannel.Id {
|
||||
found = true
|
||||
require.Nil(t, channel.PolicyID)
|
||||
break
|
||||
}
|
||||
}
|
||||
require.True(t, found)
|
||||
})
|
||||
t.Run("returns policy ID", func(t *testing.T) {
|
||||
channels, resp := th.SystemAdminClient.SearchAllChannels(&model.ChannelSearch{Term: policyChannel.Name})
|
||||
CheckOKStatus(t, resp)
|
||||
found := false
|
||||
for _, channel := range *channels {
|
||||
if channel.Id == policyChannel.Id {
|
||||
found = true
|
||||
require.Equal(t, *channel.PolicyID, policy.ID)
|
||||
break
|
||||
}
|
||||
}
|
||||
require.True(t, found)
|
||||
})
|
||||
}
|
||||
|
||||
func TestSearchAllChannelsPaged(t *testing.T) {
|
||||
|
||||
Ссылка в новой задаче
Block a user