新注册的用户请输入邮箱并保存,随后登录邮箱激活账号。后续可直接使用邮箱登录!

Commit 02555a68 authored by 志宏 蔡's avatar 志宏 蔡

fix: correct the checkAdmin() failed when 231 handle 221 tx. --bug=1004753

parent e4cae6c3
......@@ -71,6 +71,7 @@ func TestAccountManagerRuntime_ChargeGasVm(t *testing.T) {
mockTxSimContext.EXPECT().GetBlockchainStore().Return(mockBlockchainStore)
logger := mock.NewMockLogger(c)
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
gomock.InOrder(
mockTxSimContext.EXPECT().Get(syscontract.SystemContract_ACCOUNT_MANAGER.String(), []byte(FrozenPrefix+address)).Return([]byte("0"), nil).AnyTimes(),
mockTxSimContext.EXPECT().Get(syscontract.SystemContract_ACCOUNT_MANAGER.String(), []byte(AccountPrefix+address)).Return([]byte("10"), nil).AnyTimes(),
......@@ -174,6 +175,7 @@ func TestAccountManagerRuntime_FrozenAccount(t *testing.T) {
logger := mock.NewMockLogger(c)
logger.EXPECT().Infof("verify account address is:%v", address).Return().AnyTimes()
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
type fields struct {
log protocol.Logger
}
......@@ -246,6 +248,7 @@ func TestAccountManagerRuntime_GetAccountStatus(t *testing.T) {
mockTxSimContext.EXPECT().Get(syscontract.SystemContract_ACCOUNT_MANAGER.String(), []byte(FrozenPrefix+address)).Return([]byte("0"), nil).AnyTimes()
logger := mock.NewMockLogger(c)
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
logger.EXPECT().Infof("verify account address is:%v", address).Return().AnyTimes()
type fields struct {
log protocol.Logger
......@@ -323,6 +326,7 @@ func TestAccountManagerRuntime_GetAdmin(t *testing.T) {
mockTxSimContext.EXPECT().GetBlockVersion().Return(uint32(2300)).AnyTimes()
mockTxSimContext.EXPECT().Get(chainConfigContractName, []byte(chainConfigContractName)).Return(chainConfigBytes, nil).AnyTimes()
logger := mock.NewMockLogger(c)
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
logger.EXPECT().Infof("verify account address is:%v", address).Return().AnyTimes()
type fields struct {
......@@ -387,6 +391,7 @@ func TestAccountManagerRuntime_GetBalance(t *testing.T) {
mockTxSimContext.EXPECT().Get(syscontract.SystemContract_ACCOUNT_MANAGER.String(),
[]byte(AccountPrefix+address)).Return([]byte("10"), nil).AnyTimes()
logger := mock.NewMockLogger(c)
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
logger.EXPECT().Infof("verify account address is:%v", address).Return().AnyTimes()
type fields struct {
......@@ -476,6 +481,7 @@ func TestAccountManagerRuntime_RechargeGas(t *testing.T) {
logger := mock.NewMockLogger(c)
logger.EXPECT().Infof("verify account address is:%v", address).Return().AnyTimes()
logger.EXPECT().Error().Return().AnyTimes()
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
rechargeGasReq := &syscontract.RechargeGasReq{
BatchRechargeGas: []*syscontract.RechargeGas{
......@@ -578,6 +584,7 @@ func TestAccountManagerRuntime_RefundGas(t *testing.T) {
)
logger := mock.NewMockLogger(c)
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
logger.EXPECT().Infof("verify account address is:%v", address).Return().AnyTimes()
logger.EXPECT().Error(fmt.Errorf(" %s accout is frozened", address).Error()).Return().AnyTimes()
type fields struct {
......@@ -652,6 +659,7 @@ func TestAccountManagerRuntime_RefundGasVm(t *testing.T) {
logger := mock.NewMockLogger(c)
logger.EXPECT().Infof("verify account address is:%v", address).Return().AnyTimes()
logger.EXPECT().Error(errors.New("error")).Return().AnyTimes()
logger.EXPECT().Infof(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
type fields struct {
log protocol.Logger
}
......@@ -748,6 +756,7 @@ func TestAccountManagerRuntime_SetAdmin(t *testing.T) {
logger := mock.NewMockLogger(c)
logger.EXPECT().Infof("verify account address is:%v", address).Return().AnyTimes()
logger.EXPECT().Error("org id(chainmaker.org1) not in trust roots config").Return().AnyTimes()
logger.EXPECT().Infof(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
type fields struct {
log protocol.Logger
......@@ -844,6 +853,7 @@ func TestAccountManagerRuntime_UnFrozenAccount(t *testing.T) {
logger := mock.NewMockLogger(c)
logger.EXPECT().Infof("verify account address is:%v", address).Return().AnyTimes()
logger.EXPECT().Error(errors.New("error")).Return().AnyTimes()
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
type fields struct {
log protocol.Logger
......@@ -896,6 +906,7 @@ func TestAccountManagerRuntime_chargeGas(t *testing.T) {
defer c.Finish()
mockTxSimContext := mock.NewMockTxSimContext(c)
logger := mock.NewMockLogger(c)
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
gomock.InOrder(
mockTxSimContext.EXPECT().Get(syscontract.SystemContract_ACCOUNT_MANAGER.String(), []byte(FrozenPrefix+address)).Return([]byte("0"), nil).AnyTimes(),
mockTxSimContext.EXPECT().Get(syscontract.SystemContract_ACCOUNT_MANAGER.String(), []byte(AccountPrefix+address)).Return([]byte("200"), nil).AnyTimes(),
......@@ -1005,7 +1016,7 @@ func TestAccountManagerRuntime_checkAdmin(t *testing.T) {
defer c.Finish()
logger := mock.NewMockLogger(c)
logger.EXPECT().Infof("verify account address is:%v", address)
logger.EXPECT().Debugf(gomock.Any(), gomock.Any(), gomock.Any()).Return().AnyTimes()
loggerNotAdmin := mock.NewMockLogger(c)
gomock.InOrder(
loggerNotAdmin.EXPECT().Infof("verify account address is:%v", "Zx958f7550fe53d96e708b0fc95212812bec3141ea"),
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment