mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2025-09-12 22:07:17 +00:00
fix(api): deactivate issue api for disabled or external issue-tracker (#8829)
- When the issue unit is disabled for a repository, don't allow issue related APIs. - Added integration tests. - Resolves #8408 Reviewed-on: https://codeberg.org/forgejo/forgejo/pulls/8829 Reviewed-by: Gusted <gusted@noreply.codeberg.org> Co-authored-by: zokki <zokki.softwareschmiede@gmail.com> Co-committed-by: zokki <zokki.softwareschmiede@gmail.com>
This commit is contained in:
parent
8f4ebab023
commit
4247c37300
7 changed files with 252 additions and 75 deletions
|
@ -5,9 +5,12 @@
|
|||
package tests
|
||||
|
||||
import (
|
||||
"bytes"
|
||||
"context"
|
||||
"database/sql"
|
||||
"fmt"
|
||||
"io"
|
||||
"mime/multipart"
|
||||
"os"
|
||||
"path"
|
||||
"path/filepath"
|
||||
|
@ -524,3 +527,13 @@ func CreateDeclarativeRepo(t *testing.T, owner *user_model.User, name string, en
|
|||
|
||||
return CreateDeclarativeRepoWithOptions(t, owner, opts)
|
||||
}
|
||||
|
||||
func WriteImageBody(t *testing.T, buff bytes.Buffer, filename string, body *bytes.Buffer) string {
|
||||
writer := multipart.NewWriter(body)
|
||||
defer writer.Close()
|
||||
part, err := writer.CreateFormFile("attachment", filename)
|
||||
require.NoError(t, err)
|
||||
_, err = io.Copy(part, &buff)
|
||||
require.NoError(t, err)
|
||||
return writer.FormDataContentType()
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue