Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_9_d_filetest.gno

0.63 Kb ยท 33 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	boards2 "gno.land/r/gnoland/boards2/v1"
 7)
 8
 9const (
10	owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq" // @devx
11	user  address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
12)
13
14var (
15	bid boards2.BoardID
16	pid boards2.PostID
17)
18
19func init() {
20	testing.SetRealm(testing.NewUserRealm(owner))
21	bid = boards2.CreateBoard(cross, "test-board", false)
22	pid = boards2.CreateThread(cross, bid, "Foo", "bar")
23}
24
25func main() {
26	// Call using a user that has not permission to delete threads
27	testing.SetRealm(testing.NewUserRealm(user))
28
29	boards2.DeleteThread(cross, bid, pid)
30}
31
32// Error:
33// unauthorized