z_18_c_filetest.gno

0.70 Kb ยท 37 lines
 1package main
 2
 3import (
 4	"std"
 5	"testing"
 6
 7	"gno.land/p/nt/commondao"
 8
 9	boards2 "gno.land/r/gnoland/boards2/v1"
10)
11
12const owner = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
13
14var (
15	perms boards2.Permissions
16	bid   boards2.BoardID
17)
18
19func init() {
20	// Create a new permissions instance without users
21	perms = boards2.NewBasicPermissions(commondao.New())
22
23	testing.SetRealm(std.NewUserRealm(owner))
24	bid = boards2.CreateBoard(cross, "foobar", false)
25}
26
27func main() {
28	testing.SetRealm(std.NewUserRealm(owner))
29
30	boards2.SetPermissions(cross, bid, perms)
31
32	// Owner that setted new board permissions is not a member of the new permissions
33	println(boards2.IsMember(bid, owner))
34}
35
36// Output:
37// false