Skip to content

Commit

Permalink
Improve repositores code
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Sverdlov <[email protected]>
  • Loading branch information
sverdlov93 committed Nov 6, 2024
1 parent ecb74bb commit cd0fda3
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions artifactory/commands/buildtoollogin/buildtoollogin_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"os"
"os/exec"
"path/filepath"
"strings"
"testing"
)

Expand Down Expand Up @@ -156,7 +157,6 @@ func TestBuildToolLoginCommand_Pipenv(t *testing.T) {
}

func testBuildToolLoginCommandPip(t *testing.T, buildTool project.ProjectType) {

var pipConfFilePath string
if coreutils.IsWindows() {
pipConfFilePath = filepath.Join(os.Getenv("APPDATA"), "pip", "pip.ini")
Expand All @@ -166,7 +166,6 @@ func testBuildToolLoginCommandPip(t *testing.T, buildTool project.ProjectType) {
assert.NoError(t, err)
pipConfFilePath = filepath.Join(homeDir, ".config", "pip", "pip.conf")
}

// Back up the existing .pip.conf file and ensure restoration after the test.
restorePipConfFunc, err := ioutils.BackupFile(pipConfFilePath, ".pipconf.backup")
assert.NoError(t, err)
Expand Down Expand Up @@ -258,6 +257,9 @@ func TestBuildToolLoginCommand_configurePoetry(t *testing.T) {
poetryConfigContentBytes, err := os.ReadFile(poetryConfigFilePath)
assert.NoError(t, err)
poetryConfigContent := string(poetryConfigContentBytes)
// Normalize line endings for comparison.(For Windows)
poetryConfigContent = strings.ReplaceAll(poetryConfigContent, "\r\n", "\n")

assert.Contains(t, poetryConfigContent, "[repositories.test-repo]\nurl = \"https://acme.jfrog.io/artifactory/api/pypi/test-repo/simple\"")

// Validate that the auth details were set correctly in auth.toml.
Expand Down

0 comments on commit cd0fda3

Please sign in to comment.