@@ -87,7 +87,7 @@ func TestInitNewConfig(t *testing.T) {
8787 assert .Equal (t , `<?xml version="1.0" encoding="utf-8"?>
8888<configuration>
8989 <packageSources>
90- <add key="JFrogCli" value="https://server.com/artifactory/api/nuget/v3/test-repo" protocolVersion="3" allowInsecureConnections="true"/>
90+ <add key="JFrogCli" value="https://server.com/artifactory/api/nuget/v3/test-repo/index.json " protocolVersion="3" allowInsecureConnections="true"/>
9191 </packageSources>
9292 <packageSourceCredentials>
9393 <JFrogCli>
@@ -133,7 +133,7 @@ func TestGetSourceDetails(t *testing.T) {
133133 assert .NoError (t , err )
134134 assert .Equal (t , "user" , user )
135135 assert .Equal (t , "pass" , pass )
136- assert .Equal (t , "https://server.com/artifactory/api/nuget/v3/repo-name" , url )
136+ assert .Equal (t , "https://server.com/artifactory/api/nuget/v3/repo-name/index.json " , url )
137137 server .Password = ""
138138 server .AccessToken = "abc123"
139139 url , user , pass , err = GetSourceDetails (server , repoName , true )
@@ -223,45 +223,3 @@ func createNewDotnetModule(t *testing.T, tmpDir string) *build.DotnetModule {
223223 assert .NoError (t , err )
224224 return module
225225}
226-
227- func TestCreateConfigFileIfNeeded (t * testing.T ) {
228- testCases := []struct {
229- name string
230- configPath string
231- fileExists bool
232- expectedError error
233- }{
234- {
235- name : "File does not exist, create file with default content" ,
236- configPath : "/custom/path/NuGet.Config" ,
237- fileExists : false ,
238- },
239- {
240- name : "File exists, no changes" ,
241- configPath : "/custom/path/NuGet.Config" ,
242- fileExists : true ,
243- },
244- }
245-
246- // Setup for testing file existence and creation
247- for _ , testCase := range testCases {
248- t .Run (testCase .name , func (t * testing.T ) {
249- configPath := filepath .Join (t .TempDir (), testCase .configPath )
250- if testCase .fileExists {
251- assert .NoError (t , os .MkdirAll (filepath .Dir (configPath ), 0777 ))
252- assert .NoError (t , os .WriteFile (configPath , []byte {}, 0644 ))
253- }
254- err := CreateConfigFileIfNeeded (configPath )
255- assert .NoError (t , err )
256-
257- if ! testCase .fileExists {
258- // Read the content of the file
259- content , err := os .ReadFile (configPath )
260- assert .NoError (t , err )
261-
262- // Assert the content is the default config content
263- assert .Equal (t , "<configuration></configuration>" , string (content ))
264- }
265- })
266- }
267- }
0 commit comments