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

Function TestGetSignedProposal

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

Source from the content-addressed store, hash-verified

382}
383
384func TestGetSignedProposal(t *testing.T) {
385 var signedProp *pb.SignedProposal
386 var err error
387
388 sig := []byte("signature")
389
390 signID := &fakes.SignerSerializer{}
391 signID.SignReturns(sig, nil)
392
393 prop := &pb.Proposal{}
394 propBytes, _ := proto.Marshal(prop)
395 signedProp, err = protoutil.GetSignedProposal(prop, signID)
396 require.NoError(t, err, "Unexpected error getting signed proposal")
397 require.Equal(t, propBytes, signedProp.ProposalBytes,
398 "Proposal bytes did not match expected value")
399 require.Equal(t, sig, signedProp.Signature,
400 "Signature did not match expected value")
401
402 _, err = protoutil.GetSignedProposal(nil, signID)
403 require.Error(t, err, "Expected error with nil proposal")
404 _, err = protoutil.GetSignedProposal(prop, nil)
405 require.Error(t, err, "Expected error with nil signing identity")
406}
407
408func TestMockSignedEndorserProposalOrPanic(t *testing.T) {
409 var prop *pb.Proposal

Callers

nothing calls this directly

Calls 5

SignReturnsMethod · 0.95
GetSignedProposalFunction · 0.92
MarshalMethod · 0.65
ErrorMethod · 0.65
EqualMethod · 0.45

Tested by

no test coverage detected