Skip to content

Commit

Permalink
[FAB-15038] use NotTo instead of ToNot
Browse files Browse the repository at this point in the history
gofmt -r 'Expect(z).ToNot(a) -> Expect(z).NotTo(a)'

Change-Id: I4adfbbbebb5161ad5e72945a47190db2da08c783
Signed-off-by: Matthew Sykes <sykesmat@us.ibm.com>
  • Loading branch information
sykesm committed Apr 3, 2019
1 parent d321580 commit b9d6d60
Show file tree
Hide file tree
Showing 9 changed files with 112 additions and 110 deletions.
32 changes: 17 additions & 15 deletions bccsp/idemix/bridge/bridge_test.go
Expand Up @@ -190,18 +190,18 @@ var _ = Describe("Idemix Bridge", func() {
Context("secret key import", func() {
It("success", func() {
key, err := User.NewKey()
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

raw, err := key.Bytes()
Expect(err).ToNot(HaveOccurred())
Expect(raw).ToNot(BeNil())
Expect(err).NotTo(HaveOccurred())
Expect(raw).NotTo(BeNil())

key2, err := User.NewKeyFromBytes(raw)
Expect(err).ToNot(HaveOccurred())
Expect(err).NotTo(HaveOccurred())

raw2, err := key2.Bytes()
Expect(err).ToNot(HaveOccurred())
Expect(raw2).ToNot(BeNil())
Expect(err).NotTo(HaveOccurred())
Expect(raw2).NotTo(BeNil())

Expect(raw2).To(BeEquivalentTo(raw))
})
Expand Down Expand Up @@ -265,13 +265,15 @@ var _ = Describe("Idemix Bridge", func() {
E: FP256BN.NewECPbigs(FP256BN.NewBIGint(10), FP256BN.NewBIGint(20)),
})
raw, err := npk.Bytes()
Expect(err).ToNot(HaveOccurred())
Expect(raw).ToNot(BeNil())
Expect(err).NotTo(HaveOccurred())
Expect(raw).NotTo(BeNil())

npk2, err := User.NewPublicNymFromBytes(raw)
Expect(err).NotTo(HaveOccurred())

raw2, err := npk2.Bytes()
Expect(err).ToNot(HaveOccurred())
Expect(raw2).ToNot(BeNil())
Expect(err).NotTo(HaveOccurred())
Expect(raw2).NotTo(BeNil())

Expect(raw2).To(BeEquivalentTo(raw))
})
Expand Down Expand Up @@ -757,7 +759,7 @@ var _ = Describe("Idemix Bridge", func() {
&bccsp.IdemixCredentialRequestSignerOpts{IssuerNonce: []byte("pine-apple-pine-apple-pine-apple")},
)
Expect(err.Error()).To(BeEquivalentTo(fmt.Sprintf("invalid nonce, expected [%v], got [%v]", []byte("pine-apple-pine-apple-pine-apple"), IssuerNonce)))
Expect(valid).ToNot(BeTrue())
Expect(valid).NotTo(BeTrue())
})

It("invalid credential request nonce, too short", func() {
Expand All @@ -768,7 +770,7 @@ var _ = Describe("Idemix Bridge", func() {
&bccsp.IdemixCredentialRequestSignerOpts{IssuerNonce: []byte("pine-aple-pine-apple-pinapple")},
)
Expect(err.Error()).To(BeEquivalentTo("invalid issuer nonce, expected length 32, got 29"))
Expect(valid).ToNot(BeTrue())
Expect(valid).NotTo(BeTrue())
})

It("invalid credential request", func() {
Expand All @@ -784,7 +786,7 @@ var _ = Describe("Idemix Bridge", func() {
&bccsp.IdemixCredentialRequestSignerOpts{IssuerNonce: IssuerNonce},
)
Expect(err.Error()).To(BeEquivalentTo("zero knowledge proof is invalid"))
Expect(valid).ToNot(BeTrue())
Expect(valid).NotTo(BeTrue())
})

It("invalid credential request in verifying credential", func() {
Expand Down Expand Up @@ -1175,8 +1177,8 @@ var _ = Describe("Idemix Bridge", func() {
CRI: cri,
},
)
Expect(err).ToNot(HaveOccurred())
Expect(signature).ToNot(BeNil())
Expect(err).NotTo(HaveOccurred())
Expect(signature).NotTo(BeNil())

valid, err := Verifier.Verify(
IssuerPublicKey,
Expand Down
2 changes: 1 addition & 1 deletion integration/e2e/etcdraft_reconfig_test.go
Expand Up @@ -546,7 +546,7 @@ var _ = Describe("EndToEnd reconfiguration and onboarding", func() {
}, []*nwo.Orderer{o4}, peer, network)

By("Ensuring orderer4 doesn't have any errors in the logs")
Expect(orderer4Runner.Err()).ToNot(gbytes.Say("ERRO"))
Expect(orderer4Runner.Err()).NotTo(gbytes.Say("ERRO"))

By("Ensuring that all orderers don't log errors to the log")
assertNoErrorsAreLogged(ordererRunners)
Expand Down
6 changes: 3 additions & 3 deletions integration/e2e/migration_test.go
Expand Up @@ -194,7 +194,7 @@ var _ = Describe("Kafka2RaftMigration", func() {

By("Step 1, Verify: system channel config changed, get migration context")
migrationContext := nwo.CurrentConfigBlockNumber(network, peer, orderer, syschannel)
Expect(migrationContext).ToNot(Equal(0))
Expect(migrationContext).NotTo(Equal(0))

config = nwo.GetConfig(network, peer, orderer, syschannel)
updatedConfig, consensusTypeValue, err = extractOrdererConsensusType(config)
Expand Down Expand Up @@ -292,7 +292,7 @@ var _ = Describe("Kafka2RaftMigration", func() {

By("Step 1, Verify: system channel config changed, get context")
migrationContext := nwo.CurrentConfigBlockNumber(network, peer, orderer, syschannel)
Expect(migrationContext).ToNot(Equal(0))
Expect(migrationContext).NotTo(Equal(0))

//=== Step 2: Config update on standard channel, CONTEXT ===
By("Step 2: Config update on standard channel, MigrationState=CONTEXT")
Expand Down Expand Up @@ -425,7 +425,7 @@ var _ = Describe("Kafka2RaftMigration", func() {

By("Step 1, Verify: system channel config changed, get context")
migrationContext := nwo.CurrentConfigBlockNumber(network, peer, o1, syschannel)
Expect(migrationContext).ToNot(Equal(0))
Expect(migrationContext).NotTo(Equal(0))

//=== Step 2: Config update on standard channel, CONTEXT ===
By("Step 2: Config update on standard channel, MigrationState=CONTEXT")
Expand Down

0 comments on commit b9d6d60

Please sign in to comment.