MCPcopy
hub / github.com/hyperledger/fabric / TestMockSignedEndorserProposalOrPanic

Function TestMockSignedEndorserProposalOrPanic

protoutil/txutils_test.go:408–436  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

406}
407
408func TestMockSignedEndorserProposalOrPanic(t *testing.T) {
409 var prop *pb.Proposal
410 var signedProp *pb.SignedProposal
411
412 ccProposal := &pb.ChaincodeProposalPayload{}
413 cis := &pb.ChaincodeInvocationSpec{}
414 chainID := "testchannelid"
415 sig := []byte("signature")
416 creator := []byte("creator")
417 cs := &pb.ChaincodeSpec{
418 ChaincodeId: &pb.ChaincodeID{
419 Name: "mychaincode",
420 },
421 }
422
423 signedProp, prop = protoutil.MockSignedEndorserProposalOrPanic(chainID, cs,
424 creator, sig)
425 require.Equal(t, sig, signedProp.Signature,
426 "Signature did not match expected result")
427 propBytes, _ := proto.Marshal(prop)
428 require.Equal(t, propBytes, signedProp.ProposalBytes,
429 "Proposal bytes do not match expected value")
430 err := proto.Unmarshal(prop.Payload, ccProposal)
431 require.NoError(t, err, "Expected ChaincodeProposalPayload")
432 err = proto.Unmarshal(ccProposal.Input, cis)
433 require.NoError(t, err, "Expected ChaincodeInvocationSpec")
434 require.Equal(t, cs.ChaincodeId.Name, cis.ChaincodeSpec.ChaincodeId.Name,
435 "Chaincode name did not match expected value")
436}
437
438func TestMockSignedEndorserProposal2OrPanic(t *testing.T) {
439 var prop *pb.Proposal

Callers

nothing calls this directly

Calls 4

MarshalMethod · 0.65
UnmarshalMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected