2022-01-11 11:01:15 +02:00
|
|
|
package cnbutils_test
|
2021-09-14 16:14:50 +02:00
|
|
|
|
|
|
|
import (
|
|
|
|
"testing"
|
|
|
|
|
2022-01-11 11:01:15 +02:00
|
|
|
"github.com/SAP/jenkins-library/pkg/cnbutils"
|
2021-09-14 16:14:50 +02:00
|
|
|
"github.com/SAP/jenkins-library/pkg/mock"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
|
|
)
|
|
|
|
|
|
|
|
func TestBuildpackDownload(t *testing.T) {
|
2022-01-11 11:01:15 +02:00
|
|
|
var mockUtils = &cnbutils.MockUtils{
|
|
|
|
ExecMockRunner: &mock.ExecMockRunner{},
|
|
|
|
FilesMock: &mock.FilesMock{},
|
|
|
|
}
|
|
|
|
|
2021-09-14 16:14:50 +02:00
|
|
|
t.Run("successfully downloads a buildpack", func(t *testing.T) {
|
|
|
|
mockUtils.AddDir("/tmp/testtest")
|
2022-01-11 11:01:15 +02:00
|
|
|
_, err := cnbutils.DownloadBuildpacks("/test", []string{"test"}, "/test/config.json", mockUtils)
|
2021-09-14 16:14:50 +02:00
|
|
|
|
|
|
|
assert.NoError(t, err)
|
|
|
|
assert.True(t, mockUtils.HasRemovedFile("/tmp/testtest"))
|
|
|
|
})
|
|
|
|
}
|