Skip to content

Commit

Permalink
was double loading env variable and this was breaking paths
Browse files Browse the repository at this point in the history
  • Loading branch information
rsds143 committed Mar 1, 2022
1 parent 745aa22 commit 1b636cd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions cmd/login.go
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ func executeLogin(args []string, getHome func() (string, pkg.ConfFiles, error),
}
switch {
case authToken != "":
if err := makeConf(confDir, pkg.PathWithEnv(confFiles.TokenPath), authToken); err != nil {
if err := makeConf(confDir, confFiles.TokenPath, authToken); err != nil {
return WriteError, err
}
return 0, nil
Expand All @@ -133,7 +133,7 @@ func executeLogin(args []string, getHome func() (string, pkg.ConfFiles, error),
}
}
clientJSON = fmt.Sprintf("{\"clientId\":\"%v\",\"clientName\":\"%v\",\"clientSecret\":\"%v\"}", clientID, clientName, clientSecret)
if err := makeConf(confDir, pkg.PathWithEnv(confFiles.SaPath), clientJSON); err != nil {
if err := makeConf(confDir, confFiles.SaPath, clientJSON); err != nil {
return WriteError, err
}
return 0, nil
Expand Down
8 changes: 4 additions & 4 deletions cmd/login_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ func TestArgs(t *testing.T) {
if exitCode != 0 {
t.Fatalf("unexpected exit code %v", exitCode)
}
fd, err := os.Open(pkg.PathWithEnv(f))
fd, err := os.Open(f)
if err != nil {
t.Fatalf("unexpected error %v", err)
}
Expand Down Expand Up @@ -175,7 +175,7 @@ func TestArgsWithNoPermission(t *testing.T) {
if exitCode != WriteError {
t.Errorf("unexpected exit code %v", exitCode)
}
expected := fmt.Sprintf("unable to create the login file due to error open %v: permission denied", pkg.PathWithEnv(f))
expected := fmt.Sprintf("unable to create the login file due to error open %v: permission denied", f)
if err.Error() != expected {
t.Errorf("expected '%v' but was '%v'", expected, err.Error())
}
Expand Down Expand Up @@ -390,7 +390,7 @@ func TestLoginToken(t *testing.T) {
if exitCode != 0 {
t.Fatalf("unexpected exit code %v", exitCode)
}
fd, err := os.Open(pkg.PathWithEnv(f))
fd, err := os.Open(f)
if err != nil {
t.Fatalf("unexpected error %v", err)
}
Expand Down Expand Up @@ -431,7 +431,7 @@ func TestLoginTokenInvalidPerms(t *testing.T) {
if exitCode != WriteError {
t.Errorf("unexpected exit code %v", exitCode)
}
expected := fmt.Sprintf("unable to create the login file due to error open %v: permission denied", pkg.PathWithEnv(f))
expected := fmt.Sprintf("unable to create the login file due to error open %v: permission denied", f)
if err.Error() != expected {
t.Errorf("expected '%v' but was '%v'", expected, err.Error())
}
Expand Down

0 comments on commit 1b636cd

Please sign in to comment.