z_delete_thread_06_filetest.gno
1.05 Kb · 46 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 boards.ID
24)
25
26func init() {
27 testing.SetRealm(testing.NewUserRealm(owner))
28 bid = boards2.CreateBoard(cross, "test123", false, true)
29
30 // Make sure user account has the required amount of GNOT for open board actions
31 testing.IssueCoins(user, chain.Coins{{"ugnot", 3_000_000_000}})
32
33 // Create a new reply as a non member user
34 testing.SetRealm(testing.NewUserRealm(user))
35 tid = boards2.CreateThread(cross, bid, "Title", "Body")
36}
37
38func main() {
39 testing.SetRealm(testing.NewUserRealm(user2))
40
41 // Try to delete the thread of another non member user
42 boards2.DeleteThread(cross, bid, tid)
43}
44
45// Error:
46// unauthorized