package plugin import ( "context" "testing" ) func TestBridgeCallerPlugin(t *testing.T) { if got, ok := BridgeCallerPlugin(context.Background()); ok || got != "" { t.Fatalf("BridgeCallerPlugin(background) = %q, %t, want empty, false", got, ok) } ctx := WithBridgeCallerPlugin(context.Background(), "website") if got, ok := BridgeCallerPlugin(ctx); !ok || got != "website" { t.Fatalf("BridgeCallerPlugin(ctx) = %q, %t, want website, true", got, ok) } } func TestWithBridgeCallerPluginEmptyDoesNotAuthenticateCaller(t *testing.T) { ctx := WithBridgeCallerPlugin(context.Background(), "spoofed") ctx = WithBridgeCallerPlugin(ctx, "") if got, ok := BridgeCallerPlugin(ctx); ok || got != "" { t.Fatalf("BridgeCallerPlugin(ctx) = %q, %t, want empty, false", got, ok) } }