Chore: Add context to org users (#39526)
* Add context to org users * Fix go lint * Roll back xorm refactor * Use WithTransactionalDbSession * Update sqlstore.go Fix typo * Update org_users.go Fix typo
This commit is contained in:
@@ -38,6 +38,7 @@ func TestOrgUsersAPIEndpoint_userLoggedIn(t *testing.T) {
|
||||
hs := &HTTPServer{Cfg: settings}
|
||||
|
||||
sqlStore := sqlstore.InitTestDB(t)
|
||||
hs.SQLStore = sqlStore
|
||||
|
||||
loggedInUserScenario(t, "When calling GET on", "api/org/users", func(sc *scenarioContext) {
|
||||
setUpGetOrgUsersDB(t, sqlStore)
|
||||
@@ -56,7 +57,7 @@ func TestOrgUsersAPIEndpoint_userLoggedIn(t *testing.T) {
|
||||
loggedInUserScenario(t, "When calling GET on", "api/org/users/search", func(sc *scenarioContext) {
|
||||
setUpGetOrgUsersDB(t, sqlStore)
|
||||
|
||||
sc.handlerFunc = hs.SearchOrgUsersWithPaging
|
||||
sc.handlerFuncCtx = hs.SearchOrgUsersWithPaging
|
||||
sc.fakeReqWithParams("GET", sc.url, map[string]string{}).exec()
|
||||
|
||||
require.Equal(t, http.StatusOK, sc.resp.Code)
|
||||
@@ -74,7 +75,7 @@ func TestOrgUsersAPIEndpoint_userLoggedIn(t *testing.T) {
|
||||
loggedInUserScenario(t, "When calling GET with page and limit query parameters on", "api/org/users/search", func(sc *scenarioContext) {
|
||||
setUpGetOrgUsersDB(t, sqlStore)
|
||||
|
||||
sc.handlerFunc = hs.SearchOrgUsersWithPaging
|
||||
sc.handlerFuncCtx = hs.SearchOrgUsersWithPaging
|
||||
sc.fakeReqWithParams("GET", sc.url, map[string]string{"perpage": "2", "page": "2"}).exec()
|
||||
|
||||
require.Equal(t, http.StatusOK, sc.resp.Code)
|
||||
@@ -254,7 +255,6 @@ func TestOrgUsersAPIEndpoint_AccessControl(t *testing.T) {
|
||||
permissions: []*accesscontrol.Permission{{Action: accesscontrol.ActionOrgUsersRead, Scope: accesscontrol.ScopeUsersAll}},
|
||||
},
|
||||
{
|
||||
|
||||
expectedCode: http.StatusForbidden,
|
||||
desc: "UsersLookupGet should return 403 for user without required permissions",
|
||||
url: "/api/org/users/lookup",
|
||||
|
||||
Reference in New Issue
Block a user