github.phpd.cn/goreleaser/goreleaser@v0.92.0/internal/pipe/publish/publish_test.go (about)

     1  package publish
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/goreleaser/goreleaser/internal/pipe"
     7  	"github.com/goreleaser/goreleaser/pkg/config"
     8  	"github.com/goreleaser/goreleaser/pkg/context"
     9  	"github.com/stretchr/testify/require"
    10  )
    11  
    12  func TestDescription(t *testing.T) {
    13  	require.NotEmpty(t, Pipe{}.String())
    14  }
    15  
    16  func TestPublishDisable(t *testing.T) {
    17  	var ctx = context.New(config.Project{})
    18  	ctx.SkipPublish = true
    19  	require.EqualError(t, Pipe{}.Run(ctx), pipe.ErrSkipPublishEnabled.Error())
    20  }
    21  
    22  func TestPublish(t *testing.T) {
    23  	var ctx = context.New(config.Project{})
    24  	ctx.Config.Release.Disable = true
    25  	for i := range ctx.Config.Dockers {
    26  		ctx.Config.Dockers[i].SkipPush = true
    27  	}
    28  	require.NoError(t, Pipe{}.Run(ctx))
    29  }