Skip to content

armgit / Pulse

Public Imported from GitHub
0

Real-time monitoring dashboard for Proxmox VE, PBS, Docker, Kubernetes, TrueNAS and vSphere. Self-hosted, with alerts for failed backups, full disks, unhealthy containers and offline nodes.

688 B
Raw Blame
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)
	}
}