mirror of
https://github.com/rcourtman/Pulse.git
synced 2026-05-02 21:40:14 +00:00
31 lines
688 B
Go
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)
|
|
}
|
|
}
|