1
0
mirror of https://github.com/mattermost/focalboard.git synced 2025-07-15 23:54:29 +02:00

Display board statistics (#4025)

* initial commit for displaying board statistics

* lint fixes

* i18n-extract, remove log entries, cleanup

* more lint fixes

* add check for standalone mode

* update tests due to change to NotImplemented

* lint fix

* revert removing empty comment lines

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
This commit is contained in:
Scott Bishel
2022-10-25 14:28:00 -06:00
committed by GitHub
parent e9d4aeba0e
commit e3ae682eea
21 changed files with 313 additions and 4 deletions

View File

@ -3773,3 +3773,40 @@ func TestPermissionsChannel(t *testing.T) {
runTestCases(t, ttCases, testData, clients)
})
}
func TestPermissionsGetStatistics(t *testing.T) {
t.Run("plugin", func(t *testing.T) {
th := SetupTestHelperPluginMode(t)
defer th.TearDown()
clients := setupClients(th)
testData := setupData(t, th)
ttCases := []TestCase{
{"/statistics", methodGet, "", userAnon, http.StatusUnauthorized, 0},
{"/statistics", methodGet, "", userNoTeamMember, http.StatusForbidden, 0},
{"/statistics", methodGet, "", userTeamMember, http.StatusForbidden, 0},
{"/statistics", methodGet, "", userViewer, http.StatusForbidden, 0},
{"/statistics", methodGet, "", userCommenter, http.StatusForbidden, 0},
{"/statistics", methodGet, "", userEditor, http.StatusForbidden, 0},
{"/statistics", methodGet, "", userAdmin, http.StatusOK, 1},
{"/statistics", methodGet, "", userGuest, http.StatusForbidden, 0},
}
runTestCases(t, ttCases, testData, clients)
})
t.Run("local", func(t *testing.T) {
th := SetupTestHelperLocalMode(t)
defer th.TearDown()
clients := setupLocalClients(th)
testData := setupData(t, th)
ttCases := []TestCase{
{"/statistics", methodGet, "", userAnon, http.StatusUnauthorized, 0},
{"/statistics", methodGet, "", userNoTeamMember, http.StatusNotImplemented, 0},
{"/statistics", methodGet, "", userTeamMember, http.StatusNotImplemented, 0},
{"/statistics", methodGet, "", userViewer, http.StatusNotImplemented, 0},
{"/statistics", methodGet, "", userCommenter, http.StatusNotImplemented, 0},
{"/statistics", methodGet, "", userEditor, http.StatusNotImplemented, 0},
{"/statistics", methodGet, "", userAdmin, http.StatusNotImplemented, 1},
{"/statistics", methodGet, "", userGuest, http.StatusForbidden, 0},
}
runTestCases(t, ttCases, testData, clients)
})
}