z_10_filetest.gno

0.71 Kb ยท 33 lines
 1// PKGPATH: gno.land/r/demo/users_test
 2package users_test
 3
 4import (
 5	"std"
 6
 7	"gno.land/p/demo/testutils"
 8	"gno.land/r/demo/users"
 9)
10
11const admin = std.Address("g1u7y667z64x2h7vc6fmpcprgey4ck233jaww9zq")
12
13func init() {
14	caller := std.GetOrigCaller() // main
15	test2 := testutils.TestAddress("test2")
16	// as admin, invite gnouser and test2
17	std.TestSetOrigCaller(admin)
18	users.Invite(caller.String() + "\n" + test2.String())
19	// register as caller
20	std.TestSetOrigCaller(caller)
21	users.Register(admin, "gnouser", "my profile")
22}
23
24func main() {
25	// register as test2
26	test2 := testutils.TestAddress("test2")
27	std.TestSetOrigCaller(test2)
28	users.Register(admin, "test222", "my profile 2")
29	println("done")
30}
31
32// Output:
33// done