kubesphere.io/s2irun@v3.2.1+incompatible/pkg/scm/downloaders/binary/download_test.go (about)

     1  package binary
     2  
     3  import (
     4  	"github.com/kubesphere/s2irun/pkg/api"
     5  	"github.com/kubesphere/s2irun/pkg/scm/git"
     6  	testfs "github.com/kubesphere/s2irun/pkg/test/fs"
     7  	"testing"
     8  )
     9  
    10  func TestDownload(t *testing.T) {
    11  	fs := &testfs.FakeFileSystem{}
    12  	f := &File{fs}
    13  
    14  	config := &api.Config{
    15  		Source:      git.MustParse("https://kubesphere.io/etcd-operator.svg"),
    16  		IsBinaryURL: true,
    17  	}
    18  	info, err := f.Download(config)
    19  	if err != nil {
    20  		t.Errorf("Unexpected error %v", err)
    21  	}
    22  	if fs.CreateFile != "upload/src/etcd-operator.svg" {
    23  		t.Errorf("Unexpected fs.CreateFile %s", fs.CreateFile)
    24  	}
    25  	if info.Location != config.Source.String() || info.ContextDir != config.ContextDir {
    26  		t.Errorf("Unexpected info")
    27  	}
    28  }