z_23_a_filetest.gno

0.91 Kb ยท 34 lines
 1package main
 2
 3import (
 4	"std"
 5	"testing"
 6
 7	boards2 "gno.land/r/gnoland/boards2/v1"
 8)
 9
10const (
11	owner = std.Address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
12	bid   = boards2.BoardID(0)                                      // Operate on realm DAO instead of individual boards
13)
14
15func init() {
16	testing.SetRealm(std.NewUserRealm(owner))
17	boards2.InviteMember(cross, bid, "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj", boards2.RoleOwner)
18	boards2.InviteMember(cross, bid, "g1vh7krmmzfua5xjmkatvmx09z37w34lsvd2mxa5", boards2.RoleAdmin)
19}
20
21func main() {
22	testing.SetRealm(std.NewUserRealm(owner))
23
24	boards2.IterateRealmMembers(0, func(u boards2.User) bool {
25		println(u.Address, string(u.Roles[0]))
26		return false
27	})
28}
29
30// Output:
31// g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq owner
32// g1manfred47kzduec920z88wfr64ylksmdcedlf5 owner
33// g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj owner
34// g1vh7krmmzfua5xjmkatvmx09z37w34lsvd2mxa5 admin