From 91086346cb5a0690ff83708b4914a60208d5049c Mon Sep 17 00:00:00 2001 From: gail Date: Wed, 3 Apr 2024 12:12:27 +0300 Subject: [PATCH] Eyal review fixes. --- common/tests/utils.go | 9 --------- utils/coreutils/techutils.go | 27 --------------------------- utils/coreutils/techutils_test.go | 25 ------------------------- 3 files changed, 61 deletions(-) diff --git a/common/tests/utils.go b/common/tests/utils.go index 4c80a9353..b234933c2 100644 --- a/common/tests/utils.go +++ b/common/tests/utils.go @@ -76,15 +76,6 @@ func CreateDsRestsMockServer(t *testing.T, testHandler restsTestHandler) (*httpt return testServer, serverDetails, serviceManager } -func CreateXscRestsMockServer(t *testing.T, testHandler restsTestHandler) (*httptest.Server, *config.ServerDetails, artifactory.ArtifactoryServicesManager) { - testServer := CreateRestsMockServer(testHandler) - serverDetails := &config.ServerDetails{Url: testServer.URL + "/", XrayUrl: testServer.URL + "/xray/"} - - serviceManager, err := utils.CreateServiceManager(serverDetails, -1, 0, false) - assert.NoError(t, err) - return testServer, serverDetails, serviceManager -} - // Set progressbar.ShouldInitProgressBar func to always return true // so the progress bar library will be initialized and progress will be displayed. // The returned callback sets the original func back. diff --git a/utils/coreutils/techutils.go b/utils/coreutils/techutils.go index 5ec5e7ddf..fa12fc2b2 100644 --- a/utils/coreutils/techutils.go +++ b/utils/coreutils/techutils.go @@ -37,33 +37,6 @@ const ( const Pypi = "pypi" -func TechnologyToLanguage(technology Technology) CodeLanguage { - languageMap := map[Technology]CodeLanguage{ - Npm: JavaScript, - Pip: Python, - Poetry: Python, - Pipenv: Python, - Go: GoLang, - Maven: Java, - Gradle: Java, - Nuget: CSharp, - Dotnet: CSharp, - Yarn: JavaScript, - Pnpm: JavaScript, - } - return languageMap[technology] -} - -type CodeLanguage string - -const ( - JavaScript CodeLanguage = "javascript" - Python CodeLanguage = "python" - GoLang CodeLanguage = "go" - Java CodeLanguage = "java" - CSharp CodeLanguage = "C#" -) - type TechData struct { // The name of the package type used in this technology. packageType string diff --git a/utils/coreutils/techutils_test.go b/utils/coreutils/techutils_test.go index 82352d690..c69d58ebe 100644 --- a/utils/coreutils/techutils_test.go +++ b/utils/coreutils/techutils_test.go @@ -507,28 +507,3 @@ func TestContainsApplicabilityScannableTech(t *testing.T) { }) } } - -func TestTechnologyToLanguage(t *testing.T) { - tests := []struct { - name string - technology Technology - language CodeLanguage - }{ - {name: "Maven to Java", technology: Maven, language: Java}, - {name: "Gradle to Java", technology: Gradle, language: Java}, - {name: "Npm to JavaScript", technology: Npm, language: JavaScript}, - {name: "Pnpm to JavaScript", technology: Pnpm, language: JavaScript}, - {name: "Yarn to JavaScript", technology: Yarn, language: JavaScript}, - {name: "Go to GoLang", technology: Go, language: GoLang}, - {name: "Pip to Python", technology: Pip, language: Python}, - {name: "Pipenv to Python", technology: Pipenv, language: Python}, - {name: "Poetry to Python", technology: Poetry, language: Python}, - {name: "Nuget to CSharp", technology: Nuget, language: CSharp}, - {name: "Dotnet to CSharp", technology: Dotnet, language: CSharp}, - } - for _, tt := range tests { - t.Run(tt.name, func(t *testing.T) { - assert.Equalf(t, tt.language, TechnologyToLanguage(tt.technology), "TechnologyToLanguage(%v) == %v", tt.technology, tt.language) - }) - } -}