mirror of
https://github.com/woodpecker-ci/woodpecker.git
synced 2026-03-16 01:19:02 +01:00
Fix gitlab hooks and simplify config extension (#2537)
- closes #2534 - remove `IsConfigured` func from config extension. If `server.Config.Services.ConfigService != nil` it is always configured
This commit is contained in:
@@ -447,7 +447,7 @@ func (g *GitLab) getTokenAndWebURL(link string) (token, webURL string, err error
|
||||
return "", "", err
|
||||
}
|
||||
token = uri.Query().Get("access_token")
|
||||
webURL = fmt.Sprintf("%s://%s/api/hook", uri.Scheme, uri.Host)
|
||||
webURL = fmt.Sprintf("%s://%s/%s", uri.Scheme, uri.Host, strings.TrimPrefix(uri.Path, "/"))
|
||||
return token, webURL, nil
|
||||
}
|
||||
|
||||
|
||||
@@ -110,12 +110,12 @@ func Test_GitLab(t *testing.T) {
|
||||
// Test activate method
|
||||
g.Describe("Activate", func() {
|
||||
g.It("Should be success", func() {
|
||||
err := client.Activate(ctx, &user, &repo, "http://example.com/api/hook/test/test?access_token=token")
|
||||
err := client.Activate(ctx, &user, &repo, "http://example.com/api/hook?access_token=token")
|
||||
assert.NoError(t, err)
|
||||
})
|
||||
|
||||
g.It("Should be failed, when token not given", func() {
|
||||
err := client.Activate(ctx, &user, &repo, "http://example.com/api/hook/test/test")
|
||||
err := client.Activate(ctx, &user, &repo, "http://example.com/api/hook")
|
||||
|
||||
g.Assert(err).IsNotNil()
|
||||
})
|
||||
@@ -124,7 +124,7 @@ func Test_GitLab(t *testing.T) {
|
||||
// Test deactivate method
|
||||
g.Describe("Deactivate", func() {
|
||||
g.It("Should be success", func() {
|
||||
err := client.Deactivate(ctx, &user, &repo, "http://example.com/api/hook/test/test?access_token=token")
|
||||
err := client.Deactivate(ctx, &user, &repo, "http://example.com/api/hook?access_token=token")
|
||||
|
||||
g.Assert(err).IsNil()
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user