summaryrefslogtreecommitdiffstats
path: root/integrations
diff options
context:
space:
mode:
authorzeripath <art27@cantab.net>2021-03-12 17:45:49 +0000
committerGitHub <noreply@github.com>2021-03-12 18:45:49 +0100
commit42b9b46ad22840966ecac70ae4e319c49fda3d7e (patch)
tree783581b00b102d6795a57f0c07dac6bd18f42b0e /integrations
parentccfb205ad126ac6fa3490e43a8075947e05a731a (diff)
downloadgitea-42b9b46ad22840966ecac70ae4e319c49fda3d7e.tar.gz
gitea-42b9b46ad22840966ecac70ae4e319c49fda3d7e.zip
Never add labels not from this repository or organisation and remove org labels on transfer (#14928)
* Never add labels not from this repository or organisation and remove org labels on transfer Prevent the addition of labels from outside of the repository or organisation and remove organisation labels on transfer. Related #14908 * switch to use sql * subquery alias * once more around the merry go round * fix api problem
Diffstat (limited to 'integrations')
-rw-r--r--integrations/api_issue_label_test.go8
1 files changed, 4 insertions, 4 deletions
diff --git a/integrations/api_issue_label_test.go b/integrations/api_issue_label_test.go
index ddcfdd6615..64c3515dd2 100644
--- a/integrations/api_issue_label_test.go
+++ b/integrations/api_issue_label_test.go
@@ -91,22 +91,22 @@ func TestAPIAddIssueLabels(t *testing.T) {
repo := models.AssertExistsAndLoadBean(t, &models.Repository{ID: 1}).(*models.Repository)
issue := models.AssertExistsAndLoadBean(t, &models.Issue{RepoID: repo.ID}).(*models.Issue)
- label := models.AssertExistsAndLoadBean(t, &models.Label{RepoID: repo.ID}).(*models.Label)
+ _ = models.AssertExistsAndLoadBean(t, &models.Label{RepoID: repo.ID, ID: 2}).(*models.Label)
owner := models.AssertExistsAndLoadBean(t, &models.User{ID: repo.OwnerID}).(*models.User)
session := loginUser(t, owner.Name)
token := getTokenForLoggedInUser(t, session)
urlStr := fmt.Sprintf("/api/v1/repos/%s/%s/issues/%d/labels?token=%s",
- owner.Name, repo.Name, issue.Index, token)
+ repo.OwnerName, repo.Name, issue.Index, token)
req := NewRequestWithJSON(t, "POST", urlStr, &api.IssueLabelsOption{
- Labels: []int64{label.ID},
+ Labels: []int64{1, 2},
})
resp := session.MakeRequest(t, req, http.StatusOK)
var apiLabels []*api.Label
DecodeJSON(t, resp, &apiLabels)
assert.Len(t, apiLabels, models.GetCount(t, &models.IssueLabel{IssueID: issue.ID}))
- models.AssertExistsAndLoadBean(t, &models.IssueLabel{IssueID: issue.ID, LabelID: label.ID})
+ models.AssertExistsAndLoadBean(t, &models.IssueLabel{IssueID: issue.ID, LabelID: 2})
}
func TestAPIReplaceIssueLabels(t *testing.T) {