z_2_g_filetest.gno

0.70 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"
12	"gno.land/r/archive/groups"
13	users "gno.land/r/gnoland/users/v1"
14)
15
16var gid groups.GroupID
17
18func main() {
19	caller := runtime.OriginCaller()
20	testing.SetRealm(testing.NewUserRealm(caller))
21	users.Register(cross, "gnouser123")
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