Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_delete_thread_05_filetest.gno

1.11 Kb · 50 lines
 1// Open board: Test deleting a thread as the non member user that created it
 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)
19
20var (
21	bid boards.ID // Operate on board DAO
22	tid boards.ID
23)
24
25func init() {
26	testing.SetRealm(testing.NewUserRealm(owner))
27	bid = boards2.CreateBoard(cross, "test123", false, true)
28
29	// Make sure user account has the required amount of GNOT for open board actions
30	testing.IssueCoins(user, chain.Coins{{"ugnot", 3_000_000_000}})
31
32	// Create a new reply as a non member user
33	testing.SetRealm(testing.NewUserRealm(user))
34	tid = boards2.CreateThread(cross, bid, "Title", "Body")
35}
36
37func main() {
38	testing.SetRealm(testing.NewUserRealm(user))
39
40	// Delete the thread as the non member user that created it
41	boards2.DeleteThread(cross, bid, tid)
42
43	// Ensure reply doesn't exist
44	println(tid == 1)
45	println(boards2.Render("test123/1"))
46}
47
48// Output:
49// true
50// Thread not found