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") } }