Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_create_thread_06_filetest.gno

0.76 Kb · 32 lines
 1// Open board: Test creating a new thread 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)
16
17var bid boards.ID // Operate on board DAO
18
19func init() {
20	testing.SetRealm(testing.NewUserRealm(owner))
21	bid = boards2.CreateBoard(cross, "test123", false, true)
22}
23
24func main() {
25	testing.SetRealm(testing.NewUserRealm(user))
26
27	// Non members should be able to create threads only if they have enough GNOT
28	boards2.CreateThread(cross, bid, "Title", "Body")
29}
30
31// Error:
32// caller is not allowed to create threads: account amount is lower than 3000 GNOT