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>
24 lines
586 B
Go
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")
|
|
}
|
|
}
|