Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_create_reply_15_filetest.gno

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