Skip to content

Commit

Permalink
fix: test code error in git action ci
Browse files Browse the repository at this point in the history
  • Loading branch information
onlyhyde committed Nov 27, 2024
1 parent d563541 commit 15936e3
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions gno.land/cmd/gnoland/testdata/addpkg_namespace.txtar
Original file line number Diff line number Diff line change
Expand Up @@ -14,70 +14,70 @@ gnoland start

# Check if sys/users is disabled
# gui call -> sys/users.IsEnable
gnokey maketx call -pkgpath gno.land/r/sys/users -func IsEnabled -gas-fee 100000ugnot -gas-wanted 2000000 -broadcast -chainid tendermint_test gui
gnokey maketx call -pkgpath gno.land/r/sys/users -func IsEnabled -gas-fee 5ugnot -gas-wanted 2000000 -broadcast -chainid tendermint_test gui
stdout 'OK!'
stdout 'false'

# Gui should be able to addpkg on test1 addr
# gui addpkg -> gno.land/r/<addr_test1>/mysuperpkg
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/$USER_ADDR_test1/mysuperpkg -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/$USER_ADDR_test1/mysuperpkg -gas-fee 10ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
stdout 'OK!'

# Gui should be able to addpkg on random name
# gui addpkg -> gno.land/r/randomname/mysuperpkg
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/randomname/mysuperpkg -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/randomname/mysuperpkg -gas-fee 5ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
stdout 'OK!'

## When `sys/users` is enabled

# Enable `sys/users`
# admin call -> sys/users.AdminEnable
gnokey maketx call -pkgpath gno.land/r/sys/users -func AdminEnable -gas-fee 100000ugnot -gas-wanted 2000000 -broadcast -chainid tendermint_test admin
gnokey maketx call -pkgpath gno.land/r/sys/users -func AdminEnable -gas-fee 10ugnot -gas-wanted 2000000 -broadcast -chainid tendermint_test admin
stdout 'OK!'

# Check that `sys/users` has been enabled
# gui call -> sys/users.IsEnable
gnokey maketx call -pkgpath gno.land/r/sys/users -func IsEnabled -gas-fee 10ugnot -gas-wanted 2000000 -broadcast -chainid tendermint_test gui
gnokey maketx call -pkgpath gno.land/r/sys/users -func IsEnabled -gas-fee 5ugnot -gas-wanted 2000000 -broadcast -chainid tendermint_test gui
stdout 'OK!'
stdout 'true'

# Try to add a pkg an with unregistered user
# gui addpkg -> gno.land/r/<addr_test1>/one
! gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/$USER_ADDR_test1/one -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
! gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/$USER_ADDR_test1/one -gas-fee 5ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
stderr 'unauthorized user'

# Try to add a pkg with an unregistered user, on their own address as namespace
# gui addpkg -> gno.land/r/<addr_gui>/one
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/$USER_ADDR_gui/one -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/$USER_ADDR_gui/one -gas-fee 5ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
stdout 'OK!'

## Test unregistered namespace

# Call addpkg with admin user on gui namespace
# admin addpkg -> gno.land/r/guiland/one
! gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/guiland/one -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test admin
! gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/guiland/one -gas-fee 10ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test admin
stderr 'unauthorized user'

## Test registered namespace

# Test admin invites gui
# admin call -> demo/users.Invite
gnokey maketx call -pkgpath gno.land/r/demo/users -func Invite -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test -args $USER_ADDR_gui admin
gnokey maketx call -pkgpath gno.land/r/demo/users -func Invite -gas-fee 10ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test -args $USER_ADDR_gui admin
stdout 'OK!'

# test gui register namespace
# gui call -> demo/users.Register
gnokey maketx call -pkgpath gno.land/r/demo/users -func Register -gas-fee 1000000ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test -args $USER_ADDR_admin -args 'guiland' -args 'im gui' gui
gnokey maketx call -pkgpath gno.land/r/demo/users -func Register -gas-fee 2ugnot -gas-wanted 2000000 -broadcast -chainid=tendermint_test -args $USER_ADDR_admin -args 'guiland' -args 'im gui' gui
stdout 'OK!'

# Test gui publishing on guiland/one
# gui addpkg -> gno.land/r/guiland/one
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/guiland/one -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/guiland/one -gas-fee 5ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test gui
stdout 'OK!'

# Test admin publishing on guiland/two
# admin addpkg -> gno.land/r/guiland/two
! gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/guiland/two -gas-fee 1000000ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test admin
! gnokey maketx addpkg -pkgdir $WORK -pkgpath gno.land/r/guiland/two -gas-fee 10ugnot -gas-wanted 100000000 -broadcast -chainid=tendermint_test admin
stderr 'unauthorized user'

-- one.gno --
Expand Down

0 comments on commit 15936e3

Please sign in to comment.