z_12_a_filetest.gno
0.95 Kb ยท 33 lines
1package main
2
3// SEND: 1000000ugnot
4
5import (
6 "std"
7 "testing"
8
9 "gno.land/p/demo/testutils"
10 "gno.land/r/demo/boards"
11 users "gno.land/r/gnoland/users/v1"
12)
13
14func main() {
15 testing.SetRealm(std.NewUserRealm(std.Address("g1wymu47drhr0kuq2098m792lytgtj2nyx77yrsm"))) // so that CurrentRealm.Addr() matches OrigCaller
16 users.Register(cross, "gnouser123")
17 // create a post via registered user
18 bid1 := boards.CreateBoard(cross, "test_board1")
19 pid := boards.CreateThread(cross, bid1, "First Post (title)", "Body of the first post. (body)")
20 bid2 := boards.CreateBoard(cross, "test_board2")
21
22 // create a repost via anon user
23 test2 := testutils.TestAddress("test2")
24 testing.SetOriginCaller(test2)
25 testing.SetOriginSend(std.Coins{{"ugnot", 9000000}})
26
27 rid := boards.CreateRepost(cross, bid1, pid, "", "Check this out", bid2)
28 println(rid)
29 println(boards.Render("test_board1"))
30}
31
32// Error:
33// please register, otherwise minimum fee 100000000 is required if anonymous