Files
kandev/apps/backend/internal/backendapp/docker_routes_test.go
T
João Salavisa 9bfd94bcde fix(auth): scope Docker management endpoints to the caller (#3025)
Co-authored-by: Kandev Agent <agent@kandev.dev>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-25 11:38:55 +01:00

24 lines
880 B
Go

package backendapp
import (
"testing"
taskservice "github.com/kandev/kandev/internal/task/service"
)
// TestDockerSessionAuthorizerNilTaskServiceIsUntypedNil pins the fail-closed
// half of the Docker route wiring: a partial build with no task service must
// hand the handlers an untyped nil, which they treat as "deny scoped callers",
// rather than a non-nil interface wrapping a nil *Service that panics on call.
func TestDockerSessionAuthorizerNilTaskServiceIsUntypedNil(t *testing.T) {
if authorizer := dockerSessionAuthorizer(nil); authorizer != nil {
t.Fatalf("dockerSessionAuthorizer(nil) = %#v, want untyped nil", authorizer)
}
}
func TestDockerSessionAuthorizerReturnsTaskService(t *testing.T) {
if authorizer := dockerSessionAuthorizer(&taskservice.Service{}); authorizer == nil {
t.Fatal("dockerSessionAuthorizer(svc) = nil, want the task service")
}
}