z_5_d_filetest.gno
1.03 Kb · 34 lines
1package main
2
3// SEND: 1000000ugnot
4
5import (
6 "chain"
7 "strconv"
8 "testing"
9
10 "gno.land/p/nt/testutils/v0"
11 "gno.land/r/archive/boards"
12 uinit "gno.land/r/sys/users/init"
13)
14
15const admin = address("g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj")
16
17func main() {
18 testing.SetRealm(testing.NewUserRealm(address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
19 uinit.RegisterUser(cross, "gnouser123", address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))
20 // create board via registered user
21 bid := boards.CreateBoard(cross, "test_board")
22 pid := boards.CreateThread(cross, bid, "First Post (title)", "Body of the first post. (body)")
23
24 // create reply via anon user
25 test2 := testutils.TestAddress("test2")
26 testing.SetOriginCaller(test2)
27 testing.SetOriginSend(chain.Coins{{"ugnot", 9000000}})
28 boards.CreateReply(cross, bid, pid, pid, "Reply of the first post")
29
30 println(boards.Render("test_board/" + strconv.Itoa(int(pid))))
31}
32
33// Error:
34// please register, otherwise minimum fee 100000000 is required if anonymous