Remove unneeded Err field in the store result struct (#16322)

* Remove unneeded Err field in the store result struct

* Fixing references to old errors in the tests
Этот коммит содержится в:
Jesús Espino
2020-11-23 09:26:01 +01:00
коммит произвёл GitHub
родитель c54ab6da21
Коммит 9ec09c2bcd
3 изменённых файлов: 19 добавлений и 20 удалений

Просмотреть файл

@@ -2465,15 +2465,14 @@ func TestGetGroupsAllowedForReferenceInChannel(t *testing.T) {
defer th.TearDown()
var err *model.AppError
var groupsMap map[string]*model.Group
team := th.BasicTeam
channel := th.BasicChannel
group1 := th.CreateGroup()
t.Run("should return empty map when no groups with allow reference", func(t *testing.T) {
groupsMap, err = th.App.getGroupsAllowedForReferenceInChannel(channel, team)
require.Nil(t, err)
groupsMap, nErr := th.App.getGroupsAllowedForReferenceInChannel(channel, team)
require.Nil(t, nErr)
require.Len(t, groupsMap, 0)
})
@@ -2483,8 +2482,8 @@ func TestGetGroupsAllowedForReferenceInChannel(t *testing.T) {
group2 := th.CreateGroup()
t.Run("should only return groups with allow reference", func(t *testing.T) {
groupsMap, err = th.App.getGroupsAllowedForReferenceInChannel(channel, team)
require.Nil(t, err)
groupsMap, nErr := th.App.getGroupsAllowedForReferenceInChannel(channel, team)
require.Nil(t, nErr)
require.Len(t, groupsMap, 1)
require.Nil(t, groupsMap[*group2.Name])
require.Equal(t, groupsMap[*group1.Name], group1)
@@ -2507,8 +2506,8 @@ func TestGetGroupsAllowedForReferenceInChannel(t *testing.T) {
require.Nil(t, err)
t.Run("should return only groups synced to channel if channel is group constrained", func(t *testing.T) {
groupsMap, err = th.App.getGroupsAllowedForReferenceInChannel(constrainedChannel, team)
require.Nil(t, err)
groupsMap, nErr := th.App.getGroupsAllowedForReferenceInChannel(constrainedChannel, team)
require.Nil(t, nErr)
require.Len(t, groupsMap, 1)
require.Nil(t, groupsMap[*group2.Name])
require.Equal(t, groupsMap[*group1.Name], group1)
@@ -2532,8 +2531,8 @@ func TestGetGroupsAllowedForReferenceInChannel(t *testing.T) {
require.Nil(t, err)
t.Run("should return union of groups synced to team and any channels if team is group constrained", func(t *testing.T) {
groupsMap, err = th.App.getGroupsAllowedForReferenceInChannel(channel, team)
require.Nil(t, err)
groupsMap, nErr := th.App.getGroupsAllowedForReferenceInChannel(channel, team)
require.Nil(t, nErr)
require.Len(t, groupsMap, 2)
require.Nil(t, groupsMap[*group3.Name])
require.Equal(t, groupsMap[*group2.Name], group2)
@@ -2541,8 +2540,8 @@ func TestGetGroupsAllowedForReferenceInChannel(t *testing.T) {
})
t.Run("should return only subset of groups synced to channel for group constrained channel when team is also group constrained", func(t *testing.T) {
groupsMap, err = th.App.getGroupsAllowedForReferenceInChannel(constrainedChannel, team)
require.Nil(t, err)
groupsMap, nErr := th.App.getGroupsAllowedForReferenceInChannel(constrainedChannel, team)
require.Nil(t, nErr)
require.Len(t, groupsMap, 1)
require.Nil(t, groupsMap[*group3.Name])
require.Nil(t, groupsMap[*group2.Name])
@@ -2554,8 +2553,8 @@ func TestGetGroupsAllowedForReferenceInChannel(t *testing.T) {
require.Nil(t, err)
t.Run("should return all groups when team and channel are not group constrained", func(t *testing.T) {
groupsMap, err = th.App.getGroupsAllowedForReferenceInChannel(channel, team)
require.Nil(t, err)
groupsMap, nErr := th.App.getGroupsAllowedForReferenceInChannel(channel, team)
require.Nil(t, nErr)
require.Len(t, groupsMap, 3)
require.Equal(t, groupsMap[*group1.Name], group1)
require.Equal(t, groupsMap[*group2.Name], group2)