neo-go/pkg/core/native_policy_test.go

55 lines
1.5 KiB
Go
Raw Normal View History

package core
import (
"testing"
"github.com/nspcc-dev/neo-go/internal/random"
2021-01-21 12:05:15 +00:00
"github.com/nspcc-dev/neo-go/internal/testchain"
"github.com/nspcc-dev/neo-go/pkg/core/interop"
"github.com/nspcc-dev/neo-go/pkg/core/native"
"github.com/stretchr/testify/require"
)
2021-01-21 12:05:15 +00:00
func transferFundsToCommittee(t *testing.T, chain *Blockchain) {
transferTokenFromMultisigAccount(t, chain, testchain.CommitteeScriptHash(),
2021-01-22 12:12:09 +00:00
chain.contracts.GAS.Hash, 1000_00000000)
2021-01-21 12:05:15 +00:00
}
func TestFeePerByte(t *testing.T) {
chain := newTestChain(t)
t.Run("get, internal method", func(t *testing.T) {
n := chain.contracts.Policy.GetFeePerByteInternal(chain.dao)
require.Equal(t, 1000, int(n))
})
}
func TestExecFeeFactor(t *testing.T) {
chain := newTestChain(t)
t.Run("get, internal method", func(t *testing.T) {
n := chain.contracts.Policy.GetExecFeeFactorInternal(chain.dao)
require.EqualValues(t, interop.DefaultBaseExecFee, n)
})
}
func TestStoragePrice(t *testing.T) {
chain := newTestChain(t)
t.Run("get, internal method", func(t *testing.T) {
n := chain.contracts.Policy.GetStoragePriceInternal(chain.dao)
require.Equal(t, int64(native.DefaultStoragePrice), n)
})
}
func TestBlockedAccounts(t *testing.T) {
chain := newTestChain(t)
2021-01-21 12:05:15 +00:00
transferTokenFromMultisigAccount(t, chain, testchain.CommitteeScriptHash(),
chain.contracts.GAS.Hash, 100_00000000)
2020-10-21 12:51:59 +00:00
t.Run("isBlocked, internal method", func(t *testing.T) {
isBlocked := chain.contracts.Policy.IsBlockedInternal(chain.dao, random.Uint160())
require.Equal(t, false, isBlocked)
})
}