Skip to content
This repository was archived by the owner on Nov 8, 2023. It is now read-only.

Commit d4dcde2

Browse files
authored
Merge pull request #76 from s7techlab/rm-hlf
small test coverage improvements
2 parents 53d73b4 + 71a9991 commit d4dcde2

1 file changed

Lines changed: 26 additions & 0 deletions

File tree

gateway/service/service_test.go

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,12 @@ import (
66

77
. "github.com/onsi/ginkgo"
88
. "github.com/onsi/gomega"
9+
"google.golang.org/protobuf/types/known/timestamppb"
910

1011
"github.com/golang/protobuf/ptypes/empty"
1112

1213
"github.com/s7techlab/cckit/examples/cpaper_asservice"
14+
"github.com/s7techlab/cckit/examples/cpaper_asservice/schema"
1315
cpservice "github.com/s7techlab/cckit/examples/cpaper_asservice/service"
1416
"github.com/s7techlab/cckit/gateway/service"
1517
"github.com/s7techlab/cckit/gateway/service/mock"
@@ -58,6 +60,30 @@ var _ = Describe(`Service`, func() {
5860
Expect(pp.Items).To(HaveLen(0))
5961
})
6062

63+
It("Invoke chaincode with 'tx waiter' in context", func() {
64+
ctx = service.ContextWithTxWaiter(ctx, "all")
65+
_, err := cPaperGateway.Issue(ctx, &schema.IssueCommercialPaper{
66+
Issuer: "issuer",
67+
PaperNumber: "1337",
68+
ExternalId: "228",
69+
IssueDate: timestamppb.Now(),
70+
MaturityDate: timestamppb.Now(),
71+
FaceValue: 2,
72+
})
73+
Expect(err).NotTo(HaveOccurred())
74+
})
75+
76+
It("Invoke chaincode with custom identity in context", func() {
77+
signer := idtestdata.Certificates[1].MustIdentity(idtestdata.DefaultMSP)
78+
ctx = service.ContextWithDefaultSigner(ctx, signer)
79+
80+
_, err := cPaperGateway.Delete(ctx, &schema.CommercialPaperId{
81+
Issuer: "issuer",
82+
PaperNumber: "1337",
83+
})
84+
Expect(err).NotTo(HaveOccurred())
85+
})
86+
6187
It("Allow to imitate error while access to peer", func() {
6288
cPaperService.Invoker = mock.FailChaincode(ChaincodeName)
6389

0 commit comments

Comments
 (0)