You've already forked sap-jenkins-library
mirror of
https://github.com/SAP/jenkins-library.git
synced 2025-10-08 23:02:10 +02:00
37 lines
838 B
Go
37 lines
838 B
Go
//go:build unit
|
|
// +build unit
|
|
|
|
package python
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/SAP/jenkins-library/pkg/mock"
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestPublishWithVirtualEnv(t *testing.T) {
|
|
// init
|
|
mockRunner := mock.ExecMockRunner{}
|
|
|
|
// test
|
|
err := PublishPackage(mockRunner.RunExecutable, ".venv", "repository", "anything", "anything")
|
|
|
|
// assert
|
|
assert.NoError(t, err)
|
|
assert.Equal(t, ".venv/bin/pip", mockRunner.Calls[0].Exec)
|
|
assert.Equal(t, []string{
|
|
"install",
|
|
"--upgrade",
|
|
"--root-user-action=ignore",
|
|
"twine"}, mockRunner.Calls[0].Params)
|
|
assert.Equal(t, ".venv/bin/twine", mockRunner.Calls[1].Exec)
|
|
assert.Equal(t, []string{
|
|
"upload",
|
|
"--username", "anything",
|
|
"--password", "anything",
|
|
"--repository-url", "repository",
|
|
"--disable-progress-bar",
|
|
"dist/*"}, mockRunner.Calls[1].Params)
|
|
}
|