Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_accept_invite_01_filetest.gno

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