(t *testing.T)
| 382 | } |
| 383 | |
| 384 | func 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 | |
| 408 | func TestMockSignedEndorserProposalOrPanic(t *testing.T) { |
| 409 | var prop *pb.Proposal |
nothing calls this directly
no test coverage detected