mirror of
https://github.com/goreleaser/goreleaser.git
synced 2025-03-17 20:47:50 +02:00
rm duplicated code in env_test.go
This commit is contained in:
parent
1b9fbdcdbb
commit
6c51f42871
52
pipeline/env/env_test.go
vendored
52
pipeline/env/env_test.go
vendored
@ -1,6 +1,7 @@
|
||||
package env
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"testing"
|
||||
|
||||
@ -35,33 +36,32 @@ func TestInvalidEnv(t *testing.T) {
|
||||
assert.Error(Pipe{}.Run(ctx))
|
||||
}
|
||||
|
||||
func TestInvalidEnvDisabled(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
assert.NoError(os.Unsetenv("GITHUB_TOKEN"))
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
Validate: false,
|
||||
Publish: true,
|
||||
}
|
||||
assert.NoError(Pipe{}.Run(ctx))
|
||||
type flags struct {
|
||||
Validate, Publish, Snapshot bool
|
||||
}
|
||||
|
||||
func TestEnvWithoutPublish(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
assert.NoError(os.Unsetenv("GITHUB_TOKEN"))
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
Validate: true,
|
||||
Publish: false,
|
||||
func TestInvalidEnvChecksSkipped(t *testing.T) {
|
||||
for _, flag := range []flags{
|
||||
{
|
||||
Validate: false,
|
||||
Publish: true,
|
||||
}, {
|
||||
Validate: true,
|
||||
Publish: false,
|
||||
}, {
|
||||
Validate: true,
|
||||
},
|
||||
} {
|
||||
t.Run(fmt.Sprintf("%v", flag), func(t *testing.T) {
|
||||
var assert = assert.New(t)
|
||||
assert.NoError(os.Unsetenv("GITHUB_TOKEN"))
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
Validate: flag.Validate,
|
||||
Publish: flag.Publish,
|
||||
Snapshot: flag.Snapshot,
|
||||
}
|
||||
assert.NoError(Pipe{}.Run(ctx))
|
||||
})
|
||||
}
|
||||
assert.NoError(Pipe{}.Run(ctx))
|
||||
}
|
||||
|
||||
func TestSkipValidate(t *testing.T) {
|
||||
assert := assert.New(t)
|
||||
var ctx = &context.Context{
|
||||
Config: config.Project{},
|
||||
Validate: false,
|
||||
}
|
||||
assert.NoError(Pipe{}.Run(ctx))
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user