Skip to content

Commit

Permalink
Eyal review fixes.
Browse files Browse the repository at this point in the history
  • Loading branch information
gailazar300 committed Apr 3, 2024
1 parent ff916d6 commit 9108634
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 61 deletions.
9 changes: 0 additions & 9 deletions common/tests/utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down
27 changes: 0 additions & 27 deletions utils/coreutils/techutils.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
25 changes: 0 additions & 25 deletions utils/coreutils/techutils_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
})
}
}

0 comments on commit 9108634

Please sign in to comment.