2022-10-18 01:24:12 +00:00
|
|
|
// Copyright 2022 Woodpecker Authors
|
2018-02-19 22:24:10 +00:00
|
|
|
// Copyright 2018 Drone.IO Inc.
|
2018-03-21 13:02:17 +00:00
|
|
|
//
|
2018-02-19 22:24:10 +00:00
|
|
|
// Licensed under the Apache License, Version 2.0 (the "License");
|
|
|
|
// you may not use this file except in compliance with the License.
|
|
|
|
// You may obtain a copy of the License at
|
2018-03-21 13:02:17 +00:00
|
|
|
//
|
2018-02-19 22:24:10 +00:00
|
|
|
// http://www.apache.org/licenses/LICENSE-2.0
|
2018-03-21 13:02:17 +00:00
|
|
|
//
|
2018-02-19 22:24:10 +00:00
|
|
|
// Unless required by applicable law or agreed to in writing, software
|
|
|
|
// distributed under the License is distributed on an "AS IS" BASIS,
|
|
|
|
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
|
|
// See the License for the specific language governing permissions and
|
|
|
|
// limitations under the License.
|
|
|
|
|
2016-04-30 08:00:39 +00:00
|
|
|
package bitbucket
|
|
|
|
|
|
|
|
import (
|
|
|
|
"bytes"
|
2021-09-28 10:56:59 +00:00
|
|
|
"context"
|
2024-04-09 09:30:04 +00:00
|
|
|
"errors"
|
2016-04-30 08:00:39 +00:00
|
|
|
"net/http"
|
|
|
|
"net/http/httptest"
|
|
|
|
"testing"
|
|
|
|
|
2021-10-12 07:25:13 +00:00
|
|
|
"github.com/franela/goblin"
|
|
|
|
"github.com/gin-gonic/gin"
|
|
|
|
|
2023-12-08 07:15:08 +00:00
|
|
|
"go.woodpecker-ci.org/woodpecker/v2/server/forge/bitbucket/fixtures"
|
|
|
|
"go.woodpecker-ci.org/woodpecker/v2/server/forge/bitbucket/internal"
|
2024-02-13 15:19:02 +00:00
|
|
|
"go.woodpecker-ci.org/woodpecker/v2/server/forge/types"
|
2023-12-08 07:15:08 +00:00
|
|
|
"go.woodpecker-ci.org/woodpecker/v2/server/model"
|
2016-04-30 08:00:39 +00:00
|
|
|
)
|
|
|
|
|
|
|
|
func Test_bitbucket(t *testing.T) {
|
|
|
|
gin.SetMode(gin.TestMode)
|
|
|
|
|
|
|
|
s := httptest.NewServer(fixtures.Handler())
|
2023-05-31 16:30:41 +00:00
|
|
|
c := &config{url: s.URL, API: s.URL}
|
2016-04-30 08:00:39 +00:00
|
|
|
|
|
|
|
g := goblin.Goblin(t)
|
2021-09-28 10:56:59 +00:00
|
|
|
ctx := context.Background()
|
2016-04-30 08:00:39 +00:00
|
|
|
g.Describe("Bitbucket client", func() {
|
|
|
|
g.After(func() {
|
|
|
|
s.Close()
|
|
|
|
})
|
|
|
|
|
|
|
|
g.It("Should return client with default endpoint", func() {
|
2022-11-04 23:35:06 +00:00
|
|
|
forge, _ := New(&Opts{Client: "4vyW6b49Z", Secret: "a5012f6c6"})
|
2024-01-12 01:01:02 +00:00
|
|
|
|
|
|
|
f, _ := forge.(*config)
|
|
|
|
g.Assert(f.url).Equal(DefaultURL)
|
|
|
|
g.Assert(f.API).Equal(DefaultAPI)
|
|
|
|
g.Assert(f.Client).Equal("4vyW6b49Z")
|
|
|
|
g.Assert(f.Secret).Equal("a5012f6c6")
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
2016-05-01 06:22:30 +00:00
|
|
|
|
2016-04-30 08:00:39 +00:00
|
|
|
g.It("Should return the netrc file", func() {
|
2022-11-04 23:35:06 +00:00
|
|
|
forge, _ := New(&Opts{})
|
|
|
|
netrc, _ := forge.Netrc(fakeUser, fakeRepo)
|
2016-04-30 08:00:39 +00:00
|
|
|
g.Assert(netrc.Machine).Equal("bitbucket.org")
|
|
|
|
g.Assert(netrc.Login).Equal("x-token-auth")
|
|
|
|
g.Assert(netrc.Password).Equal(fakeUser.Token)
|
|
|
|
})
|
|
|
|
|
2016-05-01 06:22:30 +00:00
|
|
|
g.Describe("Given an authorization request", func() {
|
|
|
|
g.It("Should redirect to authorize", func() {
|
2024-02-13 15:19:02 +00:00
|
|
|
user, _, err := c.Login(ctx, &types.OAuthRequest{})
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2024-02-13 15:19:02 +00:00
|
|
|
g.Assert(user).IsNil()
|
2016-05-01 06:22:30 +00:00
|
|
|
})
|
|
|
|
g.It("Should return authenticated user", func() {
|
2024-02-13 15:19:02 +00:00
|
|
|
u, _, err := c.Login(ctx, &types.OAuthRequest{
|
|
|
|
Code: "code",
|
|
|
|
})
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-05-01 06:22:30 +00:00
|
|
|
g.Assert(u.Login).Equal(fakeUser.Login)
|
|
|
|
g.Assert(u.Token).Equal("2YotnFZFEjr1zCsicMWpAA")
|
|
|
|
g.Assert(u.Secret).Equal("tGzv3JOkF0XG5Qx2TlKWIA")
|
|
|
|
})
|
|
|
|
g.It("Should handle failure to exchange code", func() {
|
2024-02-13 15:19:02 +00:00
|
|
|
_, _, err := c.Login(ctx, &types.OAuthRequest{
|
|
|
|
Code: "code_bad_request",
|
|
|
|
})
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-05-01 06:22:30 +00:00
|
|
|
})
|
|
|
|
g.It("Should handle failure to resolve user", func() {
|
2024-02-13 15:19:02 +00:00
|
|
|
_, _, err := c.Login(ctx, &types.OAuthRequest{
|
|
|
|
Code: "code_user_not_found",
|
|
|
|
})
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-05-01 06:22:30 +00:00
|
|
|
})
|
2016-12-19 05:42:56 +00:00
|
|
|
g.It("Should handle authentication errors", func() {
|
2024-02-13 15:19:02 +00:00
|
|
|
_, _, err := c.Login(ctx, &types.OAuthRequest{
|
|
|
|
Error: "invalid_scope",
|
|
|
|
})
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-12-19 05:42:56 +00:00
|
|
|
})
|
2016-05-01 06:22:30 +00:00
|
|
|
})
|
|
|
|
|
2016-04-30 08:00:39 +00:00
|
|
|
g.Describe("Given an access token", func() {
|
|
|
|
g.It("Should return the authenticated user", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
login, err := c.Auth(ctx, fakeUser.Token, fakeUser.Secret)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
g.Assert(login).Equal(fakeUser.Login)
|
|
|
|
})
|
2016-05-01 06:22:30 +00:00
|
|
|
g.It("Should handle a failure to resolve user", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
_, err := c.Auth(ctx, fakeUserNotFound.Token, fakeUserNotFound.Secret)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2016-05-01 06:22:30 +00:00
|
|
|
g.Describe("Given a refresh token", func() {
|
|
|
|
g.It("Should return a refresh access token", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
ok, err := c.Refresh(ctx, fakeUserRefresh)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-05-01 06:22:30 +00:00
|
|
|
g.Assert(ok).IsTrue()
|
|
|
|
g.Assert(fakeUserRefresh.Token).Equal("2YotnFZFEjr1zCsicMWpAA")
|
|
|
|
g.Assert(fakeUserRefresh.Secret).Equal("tGzv3JOkF0XG5Qx2TlKWIA")
|
|
|
|
})
|
|
|
|
g.It("Should handle an empty access token", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
ok, err := c.Refresh(ctx, fakeUserRefreshEmpty)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-05-01 06:22:30 +00:00
|
|
|
g.Assert(ok).IsFalse()
|
|
|
|
})
|
|
|
|
g.It("Should handle a failure to refresh", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
ok, err := c.Refresh(ctx, fakeUserRefreshFail)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-05-01 06:22:30 +00:00
|
|
|
g.Assert(ok).IsFalse()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2016-04-30 08:00:39 +00:00
|
|
|
g.Describe("When requesting a repository", func() {
|
|
|
|
g.It("Should return the details", func() {
|
2022-09-05 15:08:51 +00:00
|
|
|
repo, err := c.Repo(ctx, fakeUser, "", fakeRepo.Owner, fakeRepo.Name)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
g.Assert(repo.FullName).Equal(fakeRepo.FullName)
|
|
|
|
})
|
|
|
|
g.It("Should handle not found errors", func() {
|
2022-09-05 15:08:51 +00:00
|
|
|
_, err := c.Repo(ctx, fakeUser, "", fakeRepoNotFound.Owner, fakeRepoNotFound.Name)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
g.Describe("When requesting user repositories", func() {
|
|
|
|
g.It("Should return the details", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
repos, err := c.Repos(ctx, fakeUser)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
g.Assert(repos[0].FullName).Equal(fakeRepo.FullName)
|
|
|
|
})
|
|
|
|
g.It("Should handle organization not found errors", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
_, err := c.Repos(ctx, fakeUserNoTeams)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
g.It("Should handle not found errors", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
_, err := c.Repos(ctx, fakeUserNoRepos)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
g.Describe("When requesting user teams", func() {
|
|
|
|
g.It("Should return the details", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
teams, err := c.Teams(ctx, fakeUser)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2022-09-18 07:26:13 +00:00
|
|
|
g.Assert(teams[0].Login).Equal("ueberdev42")
|
|
|
|
g.Assert(teams[0].Avatar).Equal("https://bitbucket.org/workspaces/ueberdev42/avatar/?ts=1658761964")
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
g.It("Should handle not found error", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
_, err := c.Teams(ctx, fakeUserNoTeams)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
g.Describe("When downloading a file", func() {
|
|
|
|
g.It("Should return the bytes", func() {
|
2022-10-18 01:24:12 +00:00
|
|
|
raw, err := c.File(ctx, fakeUser, fakeRepo, fakePipeline, "file")
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
g.Assert(len(raw) != 0).IsTrue()
|
|
|
|
})
|
|
|
|
g.It("Should handle not found error", func() {
|
2022-10-18 01:24:12 +00:00
|
|
|
_, err := c.File(ctx, fakeUser, fakeRepo, fakePipeline, "file_not_found")
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2024-04-09 09:30:04 +00:00
|
|
|
g.Assert(errors.Is(err, &types.ErrConfigNotFound{})).IsTrue()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-08-03 00:06:03 +00:00
|
|
|
g.Describe("When requesting repo branch HEAD", func() {
|
|
|
|
g.It("Should return the details", func() {
|
|
|
|
branchHead, err := c.BranchHead(ctx, fakeUser, fakeRepo, "branch_name")
|
|
|
|
g.Assert(err).IsNil()
|
2024-02-11 09:44:50 +00:00
|
|
|
g.Assert(branchHead.SHA).Equal("branch_head_name")
|
|
|
|
g.Assert(branchHead.ForgeURL).Equal("https://bitbucket.org/commitlink")
|
2023-08-03 00:06:03 +00:00
|
|
|
})
|
|
|
|
g.It("Should handle not found errors", func() {
|
|
|
|
_, err := c.BranchHead(ctx, fakeUser, fakeRepo, "branch_not_found")
|
|
|
|
g.Assert(err).IsNotNil()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
g.Describe("When requesting repo pull requests", func() {
|
|
|
|
listOpts := model.ListOptions{
|
|
|
|
All: false,
|
|
|
|
Page: 1,
|
|
|
|
PerPage: 10,
|
|
|
|
}
|
|
|
|
g.It("Should return the details", func() {
|
|
|
|
repoPRs, err := c.PullRequests(ctx, fakeUser, fakeRepo, &listOpts)
|
|
|
|
g.Assert(err).IsNil()
|
|
|
|
g.Assert(repoPRs[0].Title).Equal("PRs title")
|
2023-11-25 23:52:52 +00:00
|
|
|
g.Assert(repoPRs[0].Index).Equal(model.ForgeRemoteID("123"))
|
2023-08-03 00:06:03 +00:00
|
|
|
})
|
|
|
|
g.It("Should handle not found errors", func() {
|
|
|
|
_, err := c.PullRequests(ctx, fakeUser, fakeRepoNotFound, &listOpts)
|
|
|
|
g.Assert(err).IsNotNil()
|
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2023-08-02 11:15:57 +00:00
|
|
|
g.Describe("When requesting repo directory contents", func() {
|
|
|
|
g.It("Should return the details", func() {
|
|
|
|
files, err := c.Dir(ctx, fakeUser, fakeRepo, fakePipeline, "/dir")
|
|
|
|
g.Assert(err).IsNil()
|
|
|
|
g.Assert(len(files)).Equal(3)
|
|
|
|
g.Assert(files[0].Name).Equal("README.md")
|
|
|
|
g.Assert(string(files[0].Data)).Equal("dummy payload")
|
|
|
|
})
|
|
|
|
g.It("Should handle not found errors", func() {
|
2024-04-09 09:30:04 +00:00
|
|
|
_, err := c.Dir(ctx, fakeUser, fakeRepo, fakePipeline, "dir_not_found/")
|
2023-08-02 11:15:57 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2024-04-09 09:30:04 +00:00
|
|
|
g.Assert(errors.Is(err, &types.ErrConfigNotFound{})).IsTrue()
|
2023-08-02 11:15:57 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2016-04-30 08:00:39 +00:00
|
|
|
g.Describe("When activating a repository", func() {
|
|
|
|
g.It("Should error when malformed hook", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
err := c.Activate(ctx, fakeUser, fakeRepo, "%gh&%ij")
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
g.It("Should create the hook", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
err := c.Activate(ctx, fakeUser, fakeRepo, "http://127.0.0.1")
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
|
|
|
g.Describe("When deactivating a repository", func() {
|
|
|
|
g.It("Should error when listing hooks fails", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
err := c.Deactivate(ctx, fakeUser, fakeRepoNoHooks, "http://127.0.0.1")
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNotNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
g.It("Should successfully remove hooks", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
err := c.Deactivate(ctx, fakeUser, fakeRepo, "http://127.0.0.1")
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
g.It("Should successfully deactivate when hook already removed", func() {
|
2021-09-28 10:56:59 +00:00
|
|
|
err := c.Deactivate(ctx, fakeUser, fakeRepoEmptyHook, "http://127.0.0.1")
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2016-05-01 06:22:30 +00:00
|
|
|
g.Describe("Given a list of hooks", func() {
|
|
|
|
g.It("Should return the matching hook", func() {
|
|
|
|
hooks := []*internal.Hook{
|
2021-12-01 13:22:06 +00:00
|
|
|
{URL: "http://127.0.0.1/hook"},
|
2016-05-01 06:22:30 +00:00
|
|
|
}
|
|
|
|
hook := matchingHooks(hooks, "http://127.0.0.1/")
|
|
|
|
g.Assert(hook).Equal(hooks[0])
|
|
|
|
})
|
|
|
|
g.It("Should handle no matches", func() {
|
|
|
|
hooks := []*internal.Hook{
|
2021-12-01 13:22:06 +00:00
|
|
|
{URL: "http://localhost/hook"},
|
2016-05-01 06:22:30 +00:00
|
|
|
}
|
|
|
|
hook := matchingHooks(hooks, "http://127.0.0.1/")
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(hook).IsNil()
|
2016-05-01 06:22:30 +00:00
|
|
|
})
|
|
|
|
g.It("Should handle malformed hook urls", func() {
|
|
|
|
var hooks []*internal.Hook
|
|
|
|
hook := matchingHooks(hooks, "%gh&%ij")
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(hook).IsNil()
|
2016-05-01 06:22:30 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
|
2016-04-30 08:00:39 +00:00
|
|
|
g.It("Should update the status", func() {
|
2023-06-27 16:01:18 +00:00
|
|
|
err := c.Status(ctx, fakeUser, fakeRepo, fakePipeline, fakeWorkflow)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
g.It("Should parse the hook", func() {
|
|
|
|
buf := bytes.NewBufferString(fixtures.HookPush)
|
|
|
|
req, _ := http.NewRequest("POST", "/hook", buf)
|
|
|
|
req.Header = http.Header{}
|
|
|
|
req.Header.Set(hookEvent, hookPush)
|
|
|
|
|
2022-09-18 07:26:13 +00:00
|
|
|
r, b, err := c.Hook(ctx, req)
|
2021-11-04 13:42:25 +00:00
|
|
|
g.Assert(err).IsNil()
|
2022-09-18 07:26:13 +00:00
|
|
|
g.Assert(r.FullName).Equal("martinherren1984/publictestrepo")
|
|
|
|
g.Assert(b.Commit).Equal("c14c1bb05dfb1fdcdf06b31485fff61b0ea44277")
|
2016-04-30 08:00:39 +00:00
|
|
|
})
|
|
|
|
})
|
|
|
|
}
|
|
|
|
|
|
|
|
var (
|
|
|
|
fakeUser = &model.User{
|
|
|
|
Login: "superman",
|
|
|
|
Token: "cfcd2084",
|
|
|
|
}
|
|
|
|
|
2016-05-01 06:22:30 +00:00
|
|
|
fakeUserRefresh = &model.User{
|
|
|
|
Login: "superman",
|
|
|
|
Secret: "cfcd2084",
|
|
|
|
}
|
|
|
|
|
|
|
|
fakeUserRefreshFail = &model.User{
|
|
|
|
Login: "superman",
|
|
|
|
Secret: "refresh_token_not_found",
|
|
|
|
}
|
|
|
|
|
|
|
|
fakeUserRefreshEmpty = &model.User{
|
|
|
|
Login: "superman",
|
|
|
|
Secret: "refresh_token_is_empty",
|
|
|
|
}
|
|
|
|
|
2016-04-30 08:00:39 +00:00
|
|
|
fakeUserNotFound = &model.User{
|
|
|
|
Login: "superman",
|
|
|
|
Token: "user_not_found",
|
|
|
|
}
|
|
|
|
|
|
|
|
fakeUserNoTeams = &model.User{
|
|
|
|
Login: "superman",
|
|
|
|
Token: "teams_not_found",
|
|
|
|
}
|
|
|
|
|
|
|
|
fakeUserNoRepos = &model.User{
|
|
|
|
Login: "superman",
|
|
|
|
Token: "repos_not_found",
|
|
|
|
}
|
|
|
|
|
|
|
|
fakeRepo = &model.Repo{
|
|
|
|
Owner: "test_name",
|
|
|
|
Name: "repo_name",
|
|
|
|
FullName: "test_name/repo_name",
|
|
|
|
}
|
|
|
|
|
|
|
|
fakeRepoNotFound = &model.Repo{
|
|
|
|
Owner: "test_name",
|
|
|
|
Name: "repo_not_found",
|
|
|
|
FullName: "test_name/repo_not_found",
|
|
|
|
}
|
|
|
|
|
|
|
|
fakeRepoNoHooks = &model.Repo{
|
|
|
|
Owner: "test_name",
|
|
|
|
Name: "hooks_not_found",
|
|
|
|
FullName: "test_name/hooks_not_found",
|
|
|
|
}
|
|
|
|
|
|
|
|
fakeRepoEmptyHook = &model.Repo{
|
|
|
|
Owner: "test_name",
|
|
|
|
Name: "hook_empty",
|
|
|
|
FullName: "test_name/hook_empty",
|
|
|
|
}
|
|
|
|
|
2022-10-18 01:24:12 +00:00
|
|
|
fakePipeline = &model.Pipeline{
|
2016-04-30 08:00:39 +00:00
|
|
|
Commit: "9ecad50",
|
|
|
|
}
|
2021-12-28 16:02:49 +00:00
|
|
|
|
2023-06-27 16:01:18 +00:00
|
|
|
fakeWorkflow = &model.Workflow{
|
2021-12-28 16:02:49 +00:00
|
|
|
Name: "test",
|
|
|
|
State: model.StatusSuccess,
|
|
|
|
}
|
2016-04-30 08:00:39 +00:00
|
|
|
)
|