Search Apps Documentation Source Content File Folder Download Copy Actions Download

z_4_b_filetest.gno

0.71 Kb · 35 lines
 1package main
 2
 3import (
 4	"testing"
 5
 6	"gno.land/r/nt/commondao/v0"
 7)
 8
 9const (
10	owner = address("g16jpf0puufcpcjkph5nxueec8etpcldz7zwgydq") // @devx
11	user  = address("g1jg8mtutu9khhfwc4nxmuhcpftf0pajdhfvsqf5") // @test1
12)
13
14var daoID uint64
15
16func init() {
17	// Invite a user to be able to start creating DAOs
18	testing.SetRealm(testing.NewUserRealm(owner))
19	commondao.Invite(cross, user)
20
21	// Create a DAO
22	testing.SetRealm(testing.NewUserRealm(user))
23	testing.SetRealm(testing.NewCodeRealm("gno.land/r/test"))
24	daoID = commondao.New(cross, "Foo").ID()
25}
26
27func main() {
28	// Use a caller that is not the owner of the DAO
29	testing.SetRealm(testing.NewCodeRealm("gno.land/r/tests/vm"))
30
31	commondao.Get(daoID)
32}
33
34// Error:
35// unauthorized