zp_2_f_filetest.gno
0.85 Kb · 42 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 name = "Foo"
13)
14
15var daoID uint64
16
17func init() {
18 testing.SetRealm(testing.NewUserRealm(owner))
19 commondao.Invite(cross, user)
20
21 testing.SetRealm(testing.NewUserRealm(user))
22 testing.SetRealm(testing.NewCodeRealm("gno.land/r/demo/test"))
23 dao := commondao.New(cross, "Foo")
24 dao.Members().Add(user)
25
26 commondao.NewSubDAO(cross, name, dao.ID())
27
28 options := commondao.GetOptions(dao.ID())
29 options.SetAllowChildren(true)
30 options.SetAllowSubDAOPorposals(true)
31
32 daoID = dao.ID()
33}
34
35func main() {
36 testing.SetRealm(testing.NewUserRealm(user))
37
38 commondao.CreateSubDAOProposal(cross, daoID, name, "")
39}
40
41// Error:
42// a SubDAO with the same name already exists