Files
server-deploy/internal/cli/preflight_test.go

22 lines
699 B
Go

package cli
import (
"encoding/json"
"testing"
)
func TestPreflightDoesNotAuthorizeInstallation(t *testing.T) {
code, out, diagnostics := run([]string{"preflight"}, "")
var response struct {
ProtocolVersion int `json:"protocolVersion"`
Mode string `json:"mode"`
Proposal struct {
Executable bool `json:"executable"`
Blockers []string `json:"blockers"`
} `json:"proposal"`
}
if code != 0 || json.Unmarshal([]byte(out), &response) != nil || response.ProtocolVersion != 1 || response.Mode != "local-environment-proposal" || response.Proposal.Executable || len(response.Proposal.Blockers) == 0 {
t.Fatalf("unsafe report: %s %s", out, diagnostics)
}
}