diff --git a/bddtests/syschaincode/noop/chaincode.go b/bddtests/syschaincode/noop/chaincode.go index e4cd3db5d84..651242756ce 100644 --- a/bddtests/syschaincode/noop/chaincode.go +++ b/bddtests/syschaincode/noop/chaincode.go @@ -59,7 +59,7 @@ func (t *SystemChaincode) Init(stub shim.ChaincodeStubInterface, function string // Invoke runs an invocation on the system chaincode func (t *SystemChaincode) Invoke(stub shim.ChaincodeStubInterface, function string, args []string) ([]byte, error) { - if len(args) != 1 { + if len(args) != 0 || function == "" { return nil, errors.New("Noop execute operation must have one single argument.") } logger.Infof("Executing noop invoke.") diff --git a/bddtests/syschaincode/noop/chaincode_test.go b/bddtests/syschaincode/noop/chaincode_test.go index 8a000cc5450..7b271e7a234 100644 --- a/bddtests/syschaincode/noop/chaincode_test.go +++ b/bddtests/syschaincode/noop/chaincode_test.go @@ -47,7 +47,7 @@ func TestInvokeUnsupported(t *testing.T) { func TestInvokeExecuteNotEnoughArgs(t *testing.T) { var noop = SystemChaincode{mockLedger{}} - var res, err = noop.Invoke(nil, "execute", []string{}) + var res, err = noop.Invoke(nil, "", []string{}) if res != nil || err == nil { t.Errorf("Invoke.execute has to indicate error if called with less than one arguments!") } @@ -55,7 +55,7 @@ func TestInvokeExecuteNotEnoughArgs(t *testing.T) { func TestInvokeExecuteOneArgReturnsNothing(t *testing.T) { var noop = SystemChaincode{mockLedger{}} - var res, err = noop.Invoke(nil, "execute", []string{"arg1"}) + var res, err = noop.Invoke(nil, "transaction", []string{}) if res != nil || err != nil { t.Errorf("Invoke.execute has to return nil with no error.") } @@ -63,7 +63,7 @@ func TestInvokeExecuteOneArgReturnsNothing(t *testing.T) { func TestInvokeExecuteMoreArgsReturnsError(t *testing.T) { var noop = SystemChaincode{mockLedger{}} - var res, err = noop.Invoke(nil, "execute", []string{"arg1", "arg2"}) + var res, err = noop.Invoke(nil, "transaction", []string{"arg1"}) if res != nil || err == nil { t.Errorf("Invoke.execute has to return error when called with more than one arguments.") }