z_delete_reply_08_filetest.gno
1.12 Kb · 47 lines
1// Open board: Test deleting a reply of another non member user
2package main
3
4// SEND: 1000000ugnot
5
6import (
7 "chain"
8 "testing"
9
10 "gno.land/p/gnoland/boards"
11
12 boards2 "gno.land/r/gnoland/boards2/v1"
13)
14
15const (
16 owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq"
17 user address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
18 user2 address = "g125t352u4pmdrr57emc4pe04y40sknr5ztng5mt"
19)
20
21var (
22 bid boards.ID // Operate on board DAO
23 tid, rid boards.ID
24)
25
26func init() {
27 testing.SetRealm(testing.NewUserRealm(owner))
28 bid = boards2.CreateBoard(cross, "test123", false, true)
29 tid = boards2.CreateThread(cross, bid, "Title", "Body")
30
31 // Make sure user account has the required amount of GNOT for open board actions
32 testing.IssueCoins(user, chain.Coins{{"ugnot", 3_000_000_000}})
33
34 // Create a new reply as a non member user
35 testing.SetRealm(testing.NewUserRealm(user))
36 rid = boards2.CreateReply(cross, bid, tid, 0, "Comment")
37}
38
39func main() {
40 testing.SetRealm(testing.NewUserRealm(user2))
41
42 // Try to delete the reply of another non member user
43 boards2.DeleteReply(cross, bid, tid, rid)
44}
45
46// Error:
47// unauthorized