z_8_f_filetest.gno
0.86 Kb · 38 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 rootID 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 // The origin must be the invited user where invitation
22 // is removed after the first user call to create a DAO
23 testing.SetRealm(testing.NewUserRealm(user))
24
25 // Create root DAO without subDAOs
26 testing.SetRealm(testing.NewCodeRealm("gno.land/r/test"))
27 rootID = commondao.New(cross, "Root DAO").ID()
28}
29
30func main() {
31 // Use a caller that is not the owner of the DAO
32 testing.SetRealm(testing.NewCodeRealm("gno.land/r/demo/tests"))
33
34 commondao.NewIterator(rootID)
35}
36
37// Error:
38// unauthorized