Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_1_b_filetest.gno

0.77 Kb ยท 35 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/gnoland/boards"
 7
 8	boards2 "gno.land/r/boards000/v1rc1"
 9)
10
11const (
12	owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
13	admin address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
14	user  address = "g1w4ek2u33ta047h6lta047h6lta047h6ldvdwpn"
15)
16
17var bid boards.ID // Operate on board DAO
18
19func init() {
20	testing.SetRealm(testing.NewUserRealm(owner))
21	bid = boards2.CreateBoard(cross, "test123", false)
22
23	// Add an admin member
24	boards2.InviteMember(cross, bid, admin, boards2.RoleAdmin)
25}
26
27func main() {
28	// Next call will be done by the admin member
29	testing.SetRealm(testing.NewUserRealm(admin))
30
31	boards2.InviteMember(cross, bid, user, boards2.RoleOwner)
32}
33
34// Error:
35// only owners are allowed to invite other owners