[node.sh] enable the static passfile can live without .pass extension

pull/3219/head
Jacky Wang 4 years ago
parent 87e0e099c5
commit fb953742c4
No known key found for this signature in database
GPG Key ID: 1085CE5F4FF5842C
  1. 2
      internal/blsgen/passphrase.go
  2. 17
      internal/blsgen/passphrase_test.go

@ -81,7 +81,7 @@ func (pd *passDecrypter) validateConfig() error {
return errors.New("unknown PassSrcType")
}
if stringIsSet(config.passFile) {
if err := checkIsPassFile(*config.passFile); err != nil {
if err := checkIsFile(*config.passFile); err != nil {
return err
}
}

@ -18,17 +18,13 @@ import (
func TestNewPassDecrypter(t *testing.T) {
// setup
var (
testDir = filepath.Join(baseTestDir, t.Name())
existPassFile = filepath.Join(testDir, testKeys[0].publicKey+passExt)
emptyPassFile = filepath.Join(testDir, testKeys[1].publicKey+passExt)
invalidExtPassFile = filepath.Join(testDir, testKeys[1].publicKey+".invalid")
testDir = filepath.Join(baseTestDir, t.Name())
existPassFile = filepath.Join(testDir, testKeys[0].publicKey+passExt)
emptyPassFile = filepath.Join(testDir, testKeys[1].publicKey+passExt)
)
if err := writeFile(existPassFile, testKeys[0].passphrase); err != nil {
t.Fatal(err)
}
if err := writeFile(invalidExtPassFile, testKeys[1].passphrase); err != nil {
t.Fatal(err)
}
tests := []struct {
config passDecrypterConfig
@ -56,13 +52,6 @@ func TestNewPassDecrypter(t *testing.T) {
&staticPassProvider{},
},
},
{
config: passDecrypterConfig{
passSrcType: PassSrcFile,
passFile: &invalidExtPassFile,
},
expErr: errors.New("should have extension .pass"),
},
{
config: passDecrypterConfig{passSrcType: PassSrcPrompt},
expErr: nil,

Loading…
Cancel
Save