Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_2_g_filetest.gno

0.71 Kb · 36 lines
 1// PKGPATH: gno.land/p/archive/groups_test
 2package groups_test
 3
 4// SEND: 1000000ugnot
 5
 6import (
 7	"chain"
 8	"chain/runtime"
 9	"testing"
10
11	"gno.land/p/nt/testutils/v0"
12	"gno.land/r/archive/groups"
13	uinit "gno.land/r/sys/users/init"
14)
15
16var gid groups.GroupID
17
18func main() {
19	caller := runtime.OriginCaller()
20	testing.SetRealm(testing.NewUserRealm(caller))
21	uinit.RegisterUser(cross, "gnouser123", caller)
22
23	gid = groups.CreateGroup(cross, "test_group")
24	println(gid)
25
26	// delete group via anon user
27	test2 := testutils.TestAddress("test2")
28	testing.SetOriginCaller(test2)
29	testing.SetOriginSend(chain.Coins{{"ugnot", 9000000}})
30
31	groups.DeleteGroup(cross, gid)
32	println(groups.Render(""))
33}
34
35// Error:
36// unauthorized to delete group