Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

change work with config in tests #8

Merged
merged 1 commit into from
Apr 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions cc/am_test.go
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
package cc

import (
"encoding/json"
"testing"

"github.com/anoideaopen/foundation/mock"
Expand All @@ -16,6 +15,7 @@ import (
"github.com/stretchr/testify/assert"
"github.com/stretchr/testify/require"
"golang.org/x/crypto/sha3"
"google.golang.org/protobuf/encoding/protojson"
)

const (
Expand Down Expand Up @@ -278,7 +278,7 @@ func TestAclCalledFromChaincode(t *testing.T) {
},
}

cfgBytes, _ := json.Marshal(cfg)
cfgBytes, _ := protojson.Marshal(cfg)

init := ledgerMock.NewCC("fiat", NewFiatToken(token.BaseToken{}), string(cfgBytes))
require.Empty(t, init)
Expand Down
9 changes: 5 additions & 4 deletions cc/integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ import (
"github.com/stretchr/testify/require"
"golang.org/x/crypto/ed25519"
"golang.org/x/crypto/sha3"
"google.golang.org/protobuf/encoding/protojson"
)

const (
Expand Down Expand Up @@ -149,7 +150,7 @@ func TestEmitTransfer(t *testing.T) {
},
}

cfgBytes, _ := json.Marshal(cfg)
cfgBytes, _ := protojson.Marshal(cfg)

init := ledgerMock.NewCC("fiat", NewFiatToken(token.BaseToken{}), string(cfgBytes))
require.Empty(t, init)
Expand Down Expand Up @@ -207,7 +208,7 @@ func TestMultisigEmitTransfer(t *testing.T) {
Issuer: &pb.Wallet{Address: owner.Address()},
},
}
cfgBytes, _ := json.Marshal(cfg)
cfgBytes, _ := protojson.Marshal(cfg)

init := ledgerMock.NewCC("fiat", NewFiatToken(token.BaseToken{}), string(cfgBytes))
require.Empty(t, init)
Expand Down Expand Up @@ -278,7 +279,7 @@ func TestChangePubkeyMultisigAndEmitTransfer(t *testing.T) {
Issuer: &pb.Wallet{Address: owner.Address()},
},
}
cfgBytes, _ := json.Marshal(cfg)
cfgBytes, _ := protojson.Marshal(cfg)

init := ledgerMock.NewCC("fiat", NewFiatToken(token.BaseToken{}), string(cfgBytes))
require.Empty(t, init)
Expand All @@ -293,7 +294,7 @@ func TestChangePubkeyMultisigAndEmitTransfer(t *testing.T) {
err = owner.ChangeKeysFor(0, newSecretKey)
assert.NoError(t, err)

// now owner.PubKeys()[0] is another key (after owner.ChangeKeysFor() invoke)
// now owner.PubKeys()[0] is another key (after owner.ChangeKeysFor() invoke)
owner.Invoke("acl", "addUser", base58.Encode(owner.PubKeys()[0]), "kychash", "testUserID", "true")
// get new public keys
validatorsPubKeys := make([]string, 0, len(MockValidatorKeys))
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ module github.com/anoideaopen/acl
go 1.18

require (
github.com/anoideaopen/foundation v0.0.0-20240408064907-19c346547189
github.com/anoideaopen/foundation v0.0.0-20240411055802-53b67be060ea
github.com/btcsuite/btcutil v1.0.2
github.com/golang/protobuf v1.5.3
github.com/hyperledger/fabric-chaincode-go v0.0.0-20230228194215-b84622ba6a7a
Expand Down
4 changes: 2 additions & 2 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
github.com/anoideaopen/foundation v0.0.0-20240408064907-19c346547189 h1:rOUqQqZkSOjcezhYWv+zK+2uXdKwb0s+m7r2pD8zaJE=
github.com/anoideaopen/foundation v0.0.0-20240408064907-19c346547189/go.mod h1:9vEFLaOEqFfSodps31kLVFqYUIbHFaVdXSH988mv61o=
github.com/anoideaopen/foundation v0.0.0-20240411055802-53b67be060ea h1:D7vAVEbmajpcBGPxj07IKjGeNoOg71g1Y9U4HnFj1jM=
github.com/anoideaopen/foundation v0.0.0-20240411055802-53b67be060ea/go.mod h1:9vEFLaOEqFfSodps31kLVFqYUIbHFaVdXSH988mv61o=
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
Expand Down