aboutsummaryrefslogtreecommitdiffstats
path: root/integrations/api_user_orgs_test.go
diff options
context:
space:
mode:
authorGusted <williamzijl7@hotmail.com>2022-08-21 18:24:05 +0200
committerGitHub <noreply@github.com>2022-08-21 17:24:05 +0100
commit0b4c166e8a90beeb1e71ee2fc16b3a240517c82d (patch)
tree607869cf2ed3caf90cb9981ab04a8fbba8e58043 /integrations/api_user_orgs_test.go
parent6d3181406d87503dbd15e4a7c764c8963f13977f (diff)
downloadgitea-0b4c166e8a90beeb1e71ee2fc16b3a240517c82d.tar.gz
gitea-0b4c166e8a90beeb1e71ee2fc16b3a240517c82d.zip
Fix SQL Query for `SearchTeam` (#20844)
- Currently the function takes in the `UserID` option, but isn't being used within the SQL query. This patch fixes that by checking that only teams are being returned that the user belongs to. Fix #20829 Co-authored-by: delvh <dev.lh@web.de>
Diffstat (limited to 'integrations/api_user_orgs_test.go')
-rw-r--r--integrations/api_user_orgs_test.go22
1 files changed, 22 insertions, 0 deletions
diff --git a/integrations/api_user_orgs_test.go b/integrations/api_user_orgs_test.go
index 9f3487cb7f..1555b53390 100644
--- a/integrations/api_user_orgs_test.go
+++ b/integrations/api_user_orgs_test.go
@@ -26,9 +26,20 @@ func TestUserOrgs(t *testing.T) {
orgs := getUserOrgs(t, adminUsername, normalUsername)
user3 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user3"})
+ user17 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user17"})
assert.Equal(t, []*api.Organization{
{
+ ID: 17,
+ UserName: user17.Name,
+ FullName: user17.FullName,
+ AvatarURL: user17.AvatarLink(),
+ Description: "",
+ Website: "",
+ Location: "",
+ Visibility: "public",
+ },
+ {
ID: 3,
UserName: user3.Name,
FullName: user3.FullName,
@@ -82,9 +93,20 @@ func TestMyOrgs(t *testing.T) {
var orgs []*api.Organization
DecodeJSON(t, resp, &orgs)
user3 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user3"})
+ user17 := unittest.AssertExistsAndLoadBean(t, &user_model.User{Name: "user17"})
assert.Equal(t, []*api.Organization{
{
+ ID: 17,
+ UserName: user17.Name,
+ FullName: user17.FullName,
+ AvatarURL: user17.AvatarLink(),
+ Description: "",
+ Website: "",
+ Location: "",
+ Visibility: "public",
+ },
+ {
ID: 3,
UserName: user3.Name,
FullName: user3.FullName,