z_32_b_filetest.gno
1.20 Kb ยท 49 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 users "gno.land/r/gnoland/users/v1"
14)
15
16const (
17 owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
18 user address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
19 user2 address = "g125t352u4pmdrr57emc4pe04y40sknr5ztng5mt"
20)
21
22var (
23 bid boards.ID // Operate on board DAO
24 tid boards.ID
25)
26
27func init() {
28 testing.SetRealm(testing.NewUserRealm(owner))
29 bid = boards2.CreateBoard(cross, "test123", false, true)
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 // Register a username which is required to be able to add
35 // a reply and then create a new reply as a non member user.
36 testing.SetRealm(testing.NewUserRealm(user))
37 users.Register(cross, "user123")
38 tid = boards2.CreateThread(cross, bid, "Title", "Body")
39}
40
41func main() {
42 testing.SetRealm(testing.NewUserRealm(user2))
43
44 // Try to delete the thread of another non member user
45 boards2.DeleteThread(cross, bid, tid)
46}
47
48// Error:
49// unauthorized