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 println(users.Render(""))
30 println("========================================")
31 println(users.Render("?page=2"))
32 println("========================================")
33 println(users.Render("gnouser"))
34 println("========================================")
35 println(users.Render("satoshi"))
36 println("========================================")
37 println(users.Render("badname"))
38}
39
40// Output:
41// * [archives](/r/demo/users:archives)
42// * [demo](/r/demo/users:demo)
43// * [gno](/r/demo/users:gno)
44// * [gnoland](/r/demo/users:gnoland)
45// * [gnolang](/r/demo/users:gnolang)
46// * [gnouser](/r/demo/users:gnouser)
47// * [gov](/r/demo/users:gov)
48// * [nt](/r/demo/users:nt)
49// * [satoshi](/r/demo/users:satoshi)
50// * [sys](/r/demo/users:sys)
51// * [test1](/r/demo/users:test1)
52// * [x](/r/demo/users:x)
53//
54//
55// ========================================
56//
57//
58// ========================================
59// ## user gnouser
60//
61// * address = g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
62// * 9 invites
63//
64// my profile
65//
66// ========================================
67// ## user satoshi
68//
69// * address = g1w3jhxap3ta047h6lta047h6lta047h6l4mfnm7
70// * 0 invites
71// * invited by g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm
72//
73// my other profile
74//
75// ========================================
76// unknown username badname
z_5_filetest.gno
1.97 Kb ยท 76 lines