Skip to content
This repository has been archived by the owner on May 27, 2019. It is now read-only.

Commit

Permalink
Skip test when current user is not available in docker (fixes #248)
Browse files Browse the repository at this point in the history
  • Loading branch information
maximbaz committed Apr 3, 2018
1 parent 881a7e6 commit 2a9bec4
Showing 1 changed file with 10 additions and 12 deletions.
22 changes: 10 additions & 12 deletions pass/disk_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,23 +8,21 @@ import (
)

func TestDefaultStorePath(t *testing.T) {
var home, expectedCustom, expected, actual string
var expectedCustom, expected, actual string

usr, err := user.Current()

if err != nil {
t.Error(err)
}
t.Log("Unable to retrieve current user, skipping part of the test. Error: ", err)
} else {
// default directory
os.Setenv("PASSWORD_STORE_DIR", "")
expected = filepath.Join(usr.HomeDir, ".password-store")
actual, _ = defaultStorePath()

home = usr.HomeDir

// default directory
os.Setenv("PASSWORD_STORE_DIR", "")
expected = filepath.Join(home, ".password-store")
actual, _ = defaultStorePath()

if expected != actual {
t.Errorf("1: '%s' does not match '%s'", expected, actual)
if expected != actual {
t.Errorf("1: '%s' does not match '%s'", expected, actual)
}
}

// custom directory from $PASSWORD_STORE_DIR
Expand Down

0 comments on commit 2a9bec4

Please sign in to comment.