@@ -259,65 +259,6 @@ func TestConfigerInvokeJoinChainCorrectParams(t *testing.T) {
259
259
}
260
260
}
261
261
262
- func TestConfigerInvokeUpdateConfigBlock (t * testing.T ) {
263
- e := new (PeerConfiger )
264
- stub := shim .NewMockStub ("PeerConfiger" , e )
265
-
266
- // Init the policy checker
267
- policyManagerGetter := & policymocks.MockChannelPolicyManagerGetter {
268
- Managers : map [string ]policies.Manager {
269
- "mytestchainid" : & policymocks.MockChannelPolicyManager {MockPolicy : & policymocks.MockPolicy {Deserializer : & policymocks.MockIdentityDeserializer {[]byte ("Alice" ), []byte ("msg1" )}}},
270
- },
271
- }
272
-
273
- identityDeserializer := & policymocks.MockIdentityDeserializer {[]byte ("Alice" ), []byte ("msg1" )}
274
-
275
- e .policyChecker = policy .NewPolicyChecker (
276
- policyManagerGetter ,
277
- identityDeserializer ,
278
- & policymocks.MockMSPPrincipalGetter {Principal : []byte ("Alice" )},
279
- )
280
-
281
- sProp , _ := utils .MockSignedEndorserProposalOrPanic ("" , & pb.ChaincodeSpec {}, []byte ("Alice" ), []byte ("msg1" ))
282
- identityDeserializer .Msg = sProp .ProposalBytes
283
- sProp .Signature = sProp .ProposalBytes
284
- policyManagerGetter .Managers ["mytestchainid" ].(* policymocks.MockChannelPolicyManager ).MockPolicy .(* policymocks.MockPolicy ).Deserializer .(* policymocks.MockIdentityDeserializer ).Msg = sProp .ProposalBytes
285
-
286
- // Failed path: Not enough parameters
287
- args := [][]byte {[]byte ("UpdateConfigBlock" )}
288
- if res := stub .MockInvokeWithSignedProposal ("2" , args , sProp ); res .Status == shim .OK {
289
- t .Fatalf ("cscc invoke UpdateConfigBlock should have failed with invalid number of args: %v" , args )
290
- }
291
-
292
- // Failed path: wrong parameter type
293
- args = [][]byte {[]byte ("UpdateConfigBlock" ), []byte ("action" )}
294
- if res := stub .MockInvokeWithSignedProposal ("2" , args , sProp ); res .Status == shim .OK {
295
- t .Fatalf ("cscc invoke UpdateConfigBlock should have failed with null genesis block - args: %v" , args )
296
- }
297
-
298
- // Successful path for UpdateConfigBlock
299
- blockBytes := mockConfigBlock ()
300
- if blockBytes == nil {
301
- t .Fatalf ("cscc invoke UpdateConfigBlock failed because invalid block" )
302
- }
303
- args = [][]byte {[]byte ("UpdateConfigBlock" ), blockBytes }
304
- if res := stub .MockInvokeWithSignedProposal ("2" , args , sProp ); res .Status != shim .OK {
305
- t .Fatalf ("cscc invoke UpdateConfigBlock failed with: %v" , res .Message )
306
- }
307
-
308
- // Query the configuration block
309
- //chainID := []byte{143, 222, 22, 192, 73, 145, 76, 110, 167, 154, 118, 66, 132, 204, 113, 168}
310
- chainID , err := utils .GetChainIDFromBlockBytes (blockBytes )
311
- if err != nil {
312
- t .Fatalf ("cscc invoke UpdateConfigBlock failed with: %v" , err )
313
- }
314
- args = [][]byte {[]byte ("GetConfigBlock" ), []byte (chainID )}
315
- if res := stub .MockInvokeWithSignedProposal ("2" , args , sProp ); res .Status != shim .OK {
316
- t .Fatalf ("cscc invoke GetConfigBlock failed with: %v" , err )
317
- }
318
-
319
- }
320
-
321
262
func mockConfigBlock () []byte {
322
263
var blockBytes []byte = nil
323
264
block , err := configtxtest .MakeGenesisBlock ("mytestchainid" )
0 commit comments