package core import "testing" func TestPluginAPIAccepted(t *testing.T) { if !PluginAPIAccepted(PluginAPIVersion) || !PluginAPIAccepted(PluginAPIVersionExperimental) { t.Fatal("current and experimental windows must be accepted") } if PluginAPIAccepted("0.9") || PluginAPIAccepted("") { t.Fatal("unknown or empty apiVersion must be rejected") } } func TestPluginScopeAllows(t *testing.T) { open := PluginScope{} if !open.Allows("a", "p") { t.Fatal("empty scope is visible to everyone") } scoped := PluginScope{Tenants: []string{"acme"}, Projects: []string{"p1"}} if !scoped.Allows("acme", "p1") { t.Fatal("matching tenant and project should pass") } if scoped.Allows("other", "p1") || scoped.Allows("acme", "p2") { t.Fatal("scope must reject mismatches") } }