Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_18_c_filetest.gno

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