From 86b550a9393cf608d6e5ef4e0add7c25626fe54a Mon Sep 17 00:00:00 2001 From: RuiO Date: Thu, 6 Feb 2025 11:49:57 +0000 Subject: [PATCH] fix(sscs-env-var): fix typos --- internal/commands/util/configuration_test.go | 4 ++-- internal/wrappers/scan-overview-http.go | 7 +++---- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/internal/commands/util/configuration_test.go b/internal/commands/util/configuration_test.go index a6b8e3d99..1b980de53 100644 --- a/internal/commands/util/configuration_test.go +++ b/internal/commands/util/configuration_test.go @@ -130,7 +130,7 @@ func TestWriteSingleConfigKeyStringNonExistingFile_CreatingTheFileAndWritesTheKe asserts.NotNil(t, file) } -func TestChangedOnlyScsScanOverviewPathInConfigFile_ConfigFileExistsWithDefaultValues_OnlyAscaPortChangedSuccess(t *testing.T) { +func TestChangedOnlyScsScanOverviewPathInConfigFile_ConfigFileExistsWithDefaultValues_OnlyScsScanOverviewPathChangedSuccess(t *testing.T) { configuration.LoadConfiguration() configFilePath, _ := configuration.GetConfigFilePath() @@ -146,7 +146,7 @@ func TestChangedOnlyScsScanOverviewPathInConfigFile_ConfigFileExistsWithDefaultV // Assert all the other properties are the same for key, value := range oldConfig { - if key != cxAscaPort { + if key != cxScsScanOverviewPath { asserts.Equal(t, value, config[key]) } } diff --git a/internal/wrappers/scan-overview-http.go b/internal/wrappers/scan-overview-http.go index 668ea4310..28246ec10 100644 --- a/internal/wrappers/scan-overview-http.go +++ b/internal/wrappers/scan-overview-http.go @@ -19,7 +19,7 @@ type ScanOverviewHTTPWrapper struct { } func NewHTTPScanOverviewWrapper(path string) ScanOverviewWrapper { - validPath := configurePath(path) + validPath := setDefaultPath(path) return &ScanOverviewHTTPWrapper{ path: validPath, } @@ -64,10 +64,9 @@ func (r *ScanOverviewHTTPWrapper) GetSCSOverviewByScanID(scanID string) ( } } -// configurePath checks if the path is the default path, if not it writes the default path to the config file -func configurePath(path string) string { +// setDefaultPath checks if the path is the default path, if not it writes the default path to the config file +func setDefaultPath(path string) string { if path != defaultPath { - viper.Set(commonParams.ScsScanOverviewPathKey, defaultPath) configFilePath, err := configuration.GetConfigFilePath() if err != nil { logger.PrintfIfVerbose("Error getting config file path: %v", err)