Pulse/cmd/pulse/config_test.go
2026-03-18 16:06:30 +00:00

31 lines
688 B
Go

package main
import (
"testing"
"github.com/rcourtman/pulse-go-rewrite/pkg/pulsecli"
)
func TestGetPassphrase_FromEnv(t *testing.T) {
env := newTestCLIEnv()
process := newTestCLIProcess()
t.Setenv("PULSE_PASSPHRASE", "from-env")
env.Passphrase = ""
got := pulsecli.GetPassphrase(env.ConfigDeps(process), "ignored", false)
if got != "from-env" {
t.Fatalf("got %q", got)
}
}
func TestGetPassphrase_FromFlag(t *testing.T) {
env := newTestCLIEnv()
process := newTestCLIProcess()
t.Setenv("PULSE_PASSPHRASE", "")
env.Passphrase = "from-flag"
got := pulsecli.GetPassphrase(env.ConfigDeps(process), "ignored", false)
if got != "from-flag" {
t.Fatalf("got %q", got)
}
}