Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_flag_thread_02_filetest.gno

0.63 Kb · 35 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	"gno.land/p/gnoland/boards"
 7
 8	boards2 "gno.land/r/gnoland/boards2/v1"
 9)
10
11const (
12	owner address = "g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq"
13	user  address = "g1us8428u2a5satrlxzagqqa5m6vmuze025anjlj" // @test2
14)
15
16var (
17	bid boards.ID
18	pid boards.ID
19)
20
21func init() {
22	testing.SetRealm(testing.NewUserRealm(owner))
23	bid = boards2.CreateBoard(cross, "test-board", false, false)
24	pid = boards2.CreateThread(cross, bid, "Foo", "bar")
25}
26
27func main() {
28	// Make the next call as an uninvited user
29	testing.SetRealm(testing.NewUserRealm(user))
30
31	boards2.FlagThread(cross, bid, pid, "Reason")
32}
33
34// Error:
35// unauthorized