Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_create_reply_15_filetest.gno

0.86 Kb · 37 lines
 1// Open board: Test creating a new reply as a non member user that has no GNOT
 2package main
 3
 4import (
 5	"testing"
 6
 7	"gno.land/p/gnoland/boards"
 8
 9	boards2 "gno.land/r/gnoland/boards2/v1"
10)
11
12const (
13	owner   address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq"
14	user    address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
15	comment         = "Test Comment"
16)
17
18var (
19	bid boards.ID // Operate on board DAO
20	tid boards.ID
21)
22
23func init() {
24	testing.SetRealm(testing.NewUserRealm(owner))
25	bid = boards2.CreateBoard(cross, "test123", false, true)
26	tid = boards2.CreateThread(cross, bid, "Title", "Body")
27}
28
29func main() {
30	testing.SetRealm(testing.NewUserRealm(user))
31
32	// Non members should be able to add replies only if they have enough GNOT
33	boards2.CreateReply(cross, bid, tid, 0, comment)
34}
35
36// Error:
37// caller is not allowed to comment: account amount is lower than 3000 GNOT