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

Commit

Permalink
Merge pull request #76 from s7techlab/rm-hlf
Browse files Browse the repository at this point in the history
small test coverage improvements
  • Loading branch information
bogatyr285 authored Oct 26, 2021
2 parents 53d73b4 + 71a9991 commit d4dcde2
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions gateway/service/service_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@ import (

. "github.com/onsi/ginkgo"
. "github.com/onsi/gomega"
"google.golang.org/protobuf/types/known/timestamppb"

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

"github.com/s7techlab/cckit/examples/cpaper_asservice"
"github.com/s7techlab/cckit/examples/cpaper_asservice/schema"
cpservice "github.com/s7techlab/cckit/examples/cpaper_asservice/service"
"github.com/s7techlab/cckit/gateway/service"
"github.com/s7techlab/cckit/gateway/service/mock"
Expand Down Expand Up @@ -58,6 +60,30 @@ var _ = Describe(`Service`, func() {
Expect(pp.Items).To(HaveLen(0))
})

It("Invoke chaincode with 'tx waiter' in context", func() {
ctx = service.ContextWithTxWaiter(ctx, "all")
_, err := cPaperGateway.Issue(ctx, &schema.IssueCommercialPaper{
Issuer: "issuer",
PaperNumber: "1337",
ExternalId: "228",
IssueDate: timestamppb.Now(),
MaturityDate: timestamppb.Now(),
FaceValue: 2,
})
Expect(err).NotTo(HaveOccurred())
})

It("Invoke chaincode with custom identity in context", func() {
signer := idtestdata.Certificates[1].MustIdentity(idtestdata.DefaultMSP)
ctx = service.ContextWithDefaultSigner(ctx, signer)

_, err := cPaperGateway.Delete(ctx, &schema.CommercialPaperId{
Issuer: "issuer",
PaperNumber: "1337",
})
Expect(err).NotTo(HaveOccurred())
})

It("Allow to imitate error while access to peer", func() {
cPaperService.Invoker = mock.FailChaincode(ChaincodeName)

Expand Down

0 comments on commit d4dcde2

Please sign in to comment.