Search Apps Documentation Source Content File Folder Download Copy

z_7_filetest.gno

0.88 Kb ยท 36 lines
 1package main
 2
 3// SEND: 200000000ugnot
 4
 5import (
 6	"std"
 7
 8	"gno.land/p/demo/testutils"
 9	"gno.land/r/demo/users"
10)
11
12const admin = std.Address("g1manfred47kzduec920z88wfr64ylksmdcedlf5")
13
14func main() {
15	caller := std.GetOrigCaller() // main
16	users.Register("", "gnouser", "my profile")
17	// as admin, grant invites to gnouser
18	std.TestSetOrigCaller(admin)
19	users.GrantInvites(caller.String() + ":1")
20	// switch back to caller
21	std.TestSetOrigCaller(caller)
22	// invite another addr
23	test1 := testutils.TestAddress("test1")
24	users.Invite(test1.String())
25	// switch to test1
26	std.TestSetOrigCaller(test1)
27	std.TestSetOrigSend(std.Coins{{"dontcare", 1}}, nil)
28	users.Register(caller, "satoshi", "my other profile")
29	// as admin, grant invites to gnouser(again) and satoshi.
30	std.TestSetOrigCaller(admin)
31	users.GrantInvites(caller.String() + ":1\n" + test1.String() + ":1")
32	println("done")
33}
34
35// Output:
36// done