Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_create_thread_06_filetest.gno

0.89 Kb · 34 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_create_thread_06_filetest
 2
 3// Open board: Test creating a new thread as a non member user that has no GNOT
 4package z_create_thread_06_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)
18
19var bid boards.ID // Operate on board DAO
20
21func init(cur realm) {
22	testing.SetRealm(testing.NewUserRealm(owner))
23	bid = boards2.CreateBoard(cross(cur), "test123", false, true)
24}
25
26func main(cur realm) {
27	testing.SetRealm(testing.NewUserRealm(user))
28
29	// Non members should be able to create threads only if they have enough GNOT
30	boards2.CreateThread(cross(cur), bid, "Title", "Body")
31}
32
33// Error:
34// caller is not allowed to create threads: account amount is lower than 3000 GNOT