Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_edit_reply_05_filetest.gno

0.83 Kb · 37 lines
 1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_edit_reply_05_filetest
 2
 3package z_edit_reply_05_filetest
 4
 5import (
 6	"testing"
 7
 8	"gno.land/p/gnoland/boards"
 9
10	boards2 "gno.land/r/gnoland/boards2/v1"
11)
12
13const (
14	owner address = "g1rp7cmetn27eqlpjpc4vuusf8kaj746tysc0qgh"
15	user  address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
16)
17
18var (
19	bid      boards.ID
20	tid, rid boards.ID
21)
22
23func init(cur realm) {
24	testing.SetRealm(testing.NewUserRealm(owner))
25	bid = boards2.CreateBoard(cross(cur), "test-board", false, false)
26	tid = boards2.CreateThread(cross(cur), bid, "Foo", "bar")
27	rid = boards2.CreateReply(cross(cur), bid, tid, 0, "body")
28}
29
30func main(cur realm) {
31	testing.SetRealm(testing.NewUserRealm(user))
32
33	boards2.EditReply(cross(cur), bid, tid, rid, "new body")
34}
35
36// Error:
37// only the reply creator is allowed to edit it