z_33_b_filetest.gno
0.88 Kb ยท 37 lines
1// Open board: Test creating a new reply as a non member user that has no username registered
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" // @devx
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 a registered user
33 boards2.CreateReply(cross, bid, tid, 0, comment)
34}
35
36// Error:
37// a registered username is required to comment on open boards