Files
Agent-System/internal/agent/runner_auth_test.go
T
weichenandCursor d7a144de26 feat(taskrun): resume interrupted runs and harden P1 security gaps
Add confirm-gated resume API with resumable flag, Phase 5 finalize fault
and rolling-restart replay tests, Mermaid strict mode, request body limits,
and optional Runner Bearer auth between app and pi-agent.

Co-authored-by: Cursor <cursoragent@cursor.com>
2026-09-13 02:50:23 +00:00

24 lines
586 B
Go

package agent
import (
"net/http/httptest"
"testing"
)
func TestApplyRunnerAuth_SetsBearerHeader(t *testing.T) {
req := httptest.NewRequest("POST", "http://runner/v1/run", nil)
ApplyRunnerAuth(req, "secret-token")
got := req.Header.Get("Authorization")
if got != "Bearer secret-token" {
t.Fatalf("Authorization=%q", got)
}
}
func TestApplyRunnerAuth_EmptyTokenSkipsHeader(t *testing.T) {
req := httptest.NewRequest("POST", "http://runner/v1/run", nil)
ApplyRunnerAuth(req, "")
if req.Header.Get("Authorization") != "" {
t.Fatal("expected no Authorization header")
}
}