z_delete_thread_04_filetest.gno
0.93 Kb · 42 lines
1// PKGPATH: gno.land/r/gnoland/boards2/v1/filetests/z_delete_thread_04_filetest
2
3package z_delete_thread_04_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 member address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
16)
17
18var (
19 bid boards.ID
20 pid 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 pid = boards2.CreateThread(cross(cur), bid, "Foo", "bar")
27
28 // Invite a member using a role with permission to delete threads
29 boards2.InviteMember(cross(cur), bid, member, boards2.RoleAdmin)
30}
31
32func main(cur realm) {
33 testing.SetRealm(testing.NewUserRealm(member))
34
35 boards2.DeleteThread(cross(cur), bid, pid)
36
37 // Ensure thread doesn't exist
38 println(boards2.Render("test-board/1"))
39}
40
41// Output:
42// Thread not found