mirror of
https://github.com/go-gitea/gitea.git
synced 2026-05-11 09:15:31 +02:00
fix tests
This commit is contained in:
parent
b7ae17c92a
commit
00efb1af42
@ -709,8 +709,21 @@ func getCurrentRunJobsByPathParam(ctx *context_module.Context) (*actions_model.A
|
||||
}
|
||||
|
||||
func getCurrentRunAndUploadedArtifacts(ctx *context_module.Context, artifactName string) (*actions_model.ActionRun, []*actions_model.ActionArtifact, bool) {
|
||||
run := getCurrentRunByPathParam(ctx)
|
||||
if ctx.Written() {
|
||||
var (
|
||||
run *actions_model.ActionRun
|
||||
err error
|
||||
)
|
||||
if ctx.PathParam("run") == "latest" {
|
||||
run, err = actions_model.GetLatestRun(ctx, ctx.Repo.Repository.ID)
|
||||
} else {
|
||||
run, err = actions_model.GetRunByIndex(ctx, ctx.Repo.Repository.ID, ctx.PathParamInt64("run"))
|
||||
}
|
||||
if err != nil {
|
||||
if errors.Is(err, util.ErrNotExist) {
|
||||
ctx.HTTPError(http.StatusNotFound, err.Error())
|
||||
return nil, nil, false
|
||||
}
|
||||
ctx.ServerError("GetRunByIndex", err)
|
||||
return nil, nil, false
|
||||
}
|
||||
|
||||
|
||||
@ -35,7 +35,7 @@ func TestActionsArtifactPreviewSingleFile(t *testing.T) {
|
||||
req := NewRequestf(t, "GET", "/%s/actions/runs/187/artifacts/artifact-download/preview", repo.FullName())
|
||||
resp := session.MakeRequest(t, req, http.StatusOK)
|
||||
assert.Contains(t, resp.Body.String(), "abc.txt")
|
||||
assert.Contains(t, resp.Body.String(), "/preview/raw?path=abc.txt")
|
||||
assert.Contains(t, resp.Body.String(), "/preview/raw/abc.txt")
|
||||
|
||||
req = NewRequestf(t, "GET", "/%s/actions/runs/187/artifacts/artifact-download/preview/raw", repo.FullName())
|
||||
resp = session.MakeRequest(t, req, http.StatusOK)
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user