Files
mesh-delivery/modules/mesh-grants/internal/buscompose/askstreams_test.go
T
jschoubben 4289d5583b grants: the part's account may create the seats' ask streams it makes
The bus refused SEAT_MESH_BUILDS's and SEAT_MESH_WANTS's create: the part's account is granted each stream it creates by
name, and the ask streams were not named. They join the declared streams, as the kept-event streams do.
2026-11-15 18:36:55 +01:00

23 lines
871 B
Go

package buscompose
import (
"slices"
"testing"
)
// The grants part may create each seat's ask stream it makes (AskStreamsOf), by its name alone (lead-47, 2026-11-15: the bus
// refused SEAT_MESH_BUILDS's create because the part's account named no such stream).
func TestTheGrantsPartMayCreateTheSeatsAskStreams(t *testing.T) {
got := declaredStreamsOf(Records{AskStreams: []string{"SEAT_MESH_BUILDS"}})
if !slices.Contains(got, "SEAT_MESH_BUILDS") {
t.Fatalf("declared streams %v lack the builds seat's ask stream", got)
}
perms, err := PermissionsFor(Principal{Kind: KindModule, Node: "one", Module: GrantsModule, CreatesStreams: got})
if err != nil {
t.Fatal(err)
}
if !MayPublish(perms, "$JS.API.STREAM.CREATE.SEAT_MESH_BUILDS") || MayPublish(perms, "$JS.API.STREAM.CREATE.SEAT_OTHER") {
t.Errorf("the grants part's creates: %v", perms.Publish)
}
}