@@ -2,19 +2,15 @@ package dependencies
22
33import (
44 "context"
5- "fmt"
65 "net/url"
7- "os"
86 "path"
9- "path/filepath"
107 "reflect"
118 "runtime"
129 "testing"
1310
1411 "github.com/stretchr/testify/require"
1512
1613 "github.com/keboola/keboola-as-code/internal/pkg/filesystem"
17- "github.com/keboola/keboola-as-code/internal/pkg/filesystem/aferofs"
1814 "github.com/keboola/keboola-as-code/internal/pkg/model"
1915 "github.com/keboola/keboola-as-code/internal/pkg/service/common/configmap"
2016 "github.com/keboola/keboola-as-code/internal/pkg/service/common/dependencies"
@@ -37,14 +33,9 @@ func NewMockedAPIScope(tb testing.TB, ctx context.Context, cfg config.Config, op
3733
3834 // Prepare test repository with templates, instead of default repositories, to prevent loading of all production templates.
3935 if reflect .DeepEqual (cfg .Repositories , config .DefaultRepositories ()) {
40- tmpDir := tb .TempDir ()
4136 _ , filename , _ , _ := runtime .Caller (0 )
42- srcFs , err := aferofs .NewLocalFs (path .Dir (filename ))
43- require .NoError (tb , err )
44- require .NoError (tb , aferofs .CopyFs2Fs (srcFs , filesystem .Join ("git_test" , "repository" ), nil , tmpDir ))
45- require .NoError (tb , os .Rename (filepath .Join (tmpDir , ".gittest" ), filepath .Join (tmpDir , ".git" ))) // nolint:forbidigo
4637 cfg .Repositories = []model.TemplateRepository {{
47- Type : model .RepositoryTypeGit , Name : "keboola" , URL : fmt . Sprintf ( "file://%s " , tmpDir ), Ref : "main" ,
38+ Type : model .RepositoryTypeDir , Name : "keboola" , URL : filesystem . Join ( path . Dir ( filename ), "git_test " , "repository" ) ,
4839 }}
4940 }
5041
0 commit comments