mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-01-08 03:31:59 +02:00
2e376ef378
Signed-off-by: Carlos Alexandro Becker <caarlos0@gmail.com>
33 lines
783 B
Go
33 lines
783 B
Go
package client
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/goreleaser/goreleaser/pkg/config"
|
|
"github.com/goreleaser/goreleaser/pkg/context"
|
|
"github.com/stretchr/testify/require"
|
|
)
|
|
|
|
func TestGitLabReleaseURLTemplate(t *testing.T) {
|
|
ctx := context.New(config.Project{
|
|
GitLabURLs: config.GitLabURLs{
|
|
// default URL would otherwise be set via pipe/defaults
|
|
Download: DefaultGitLabDownloadURL,
|
|
},
|
|
Release: config.Release{
|
|
GitLab: config.Repo{
|
|
Owner: "owner",
|
|
Name: "name",
|
|
},
|
|
},
|
|
})
|
|
client, err := NewGitLab(ctx, ctx.Token)
|
|
require.NoError(t, err)
|
|
|
|
urlTpl, err := client.ReleaseURLTemplate(ctx)
|
|
require.NoError(t, err)
|
|
|
|
expectedURL := "https://gitlab.com/owner/name/-/releases/{{ .Tag }}/downloads/{{ .ArtifactName }}"
|
|
require.Equal(t, expectedURL, urlTpl)
|
|
}
|