Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_3_g_filetest.gno

1.18 Kb ยท 45 lines
 1package main
 2
 3// SEND: 1000000ugnot
 4
 5import (
 6	"testing"
 7
 8	"gno.land/p/gnoland/boards"
 9
10	boards2 "gno.land/r/boards000/v1rc1"
11	users "gno.land/r/gnoland/users/v1"
12)
13
14const (
15	owner   address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
16	member  address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
17	member2 address = "g1vh7krmmzfua5xjmkatvmx09z37w34lsvd2mxa5"
18	name            = "foo123"
19	newName         = "barbaz123"
20)
21
22var bid boards.ID // Operate on board DAO
23
24func init() {
25	testing.SetRealm(testing.NewUserRealm(owner))
26	bid = boards2.CreateBoard(cross, name, false)
27	boards2.InviteMember(cross, bid, member, boards2.RoleOwner)
28
29	// Test1 is the boards owner and its address has a user already registered
30	// so a new member must register a user with the new board name.
31	testing.SetRealm(testing.NewUserRealm(member))
32	users.Register(cross, newName)
33
34	// Invite a new member that doesn't own the user that matches the new board name
35	boards2.InviteMember(cross, bid, member2, boards2.RoleOwner)
36}
37
38func main() {
39	testing.SetRealm(testing.NewUserRealm(member2))
40
41	boards2.RenameBoard(cross, name, newName)
42}
43
44// Error:
45// board name is a user name registered to a different user