Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_26_b_filetest.gno

0.86 Kb ยท 39 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/gnoland/boards"
 7
 8	boards2 "gno.land/r/gnoland/boards2/v1"
 9	"gno.land/r/gnoland/boards2/v1/permissions"
10)
11
12const (
13	owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
14	user  address = "g1vh7krmmzfua5xjmkatvmx09z37w34lsvd2mxa5"
15)
16
17var bid boards.ID
18
19func init() {
20	testing.SetRealm(testing.NewUserRealm(owner))
21	bid = boards2.CreateBoard(cross, "test123", false, false)
22
23	// Request an invite as a user that is not a member
24	testing.SetRealm(testing.NewUserRealm(user))
25	boards2.RequestInvite(cross, bid)
26
27	// Add user as a member idependently of the invite request
28	testing.SetRealm(testing.NewUserRealm(owner))
29	boards2.InviteMember(cross, bid, user, permissions.RoleGuest)
30}
31
32func main() {
33	testing.SetRealm(testing.NewUserRealm(owner))
34
35	boards2.AcceptInvite(cross, bid, user)
36}
37
38// Error:
39// user is already a member