1
0
Fork 0
mirror of https://github.com/portainer/portainer.git synced 2025-07-24 15:59:41 +02:00

feat(git) git clone improvements [EE-451] (#5070)

This commit is contained in:
dbuduev 2021-05-24 17:27:07 +12:00 committed by GitHub
parent 2270de73ee
commit 3568fe9e52
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
14 changed files with 980 additions and 85 deletions

32
api/archive/zip_test.go Normal file
View file

@ -0,0 +1,32 @@
package archive
import (
"github.com/stretchr/testify/assert"
"io/ioutil"
"os"
"path/filepath"
"testing"
)
func TestUnzipFile(t *testing.T) {
dir, err := ioutil.TempDir("", "unzip-test-")
assert.NoError(t, err)
defer os.RemoveAll(dir)
/*
Archive structure.
0
1
2.txt
1.txt
0.txt
*/
err = UnzipFile("./testdata/sample_archive.zip", dir)
assert.NoError(t, err)
archiveDir := dir + "/sample_archive"
assert.FileExists(t, filepath.Join(archiveDir, "0.txt"))
assert.FileExists(t, filepath.Join(archiveDir, "0", "1.txt"))
assert.FileExists(t, filepath.Join(archiveDir, "0", "1", "2.txt"))
}