(t *testing.T)
| 406 | } |
| 407 | |
| 408 | func 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 | |
| 438 | func TestMockSignedEndorserProposal2OrPanic(t *testing.T) { |
| 439 | var prop *pb.Proposal |
nothing calls this directly
no test coverage detected