@@ -276,15 +276,6 @@ func createLSCCTxPutCds(ccname, ccver, f string, res, cdsbytes []byte, putcds bo
276
276
return utils .CreateSignedTx (prop , id , presp )
277
277
}
278
278
279
- func TestInit (t * testing.T ) {
280
- v := New (NewMockProvider ())
281
- stub := shim .NewMockStub ("validatoronevalidsignature" , v )
282
-
283
- if res := stub .MockInit ("1" , nil ); res .Status != shim .OK {
284
- t .Fatalf ("vscc init failed with %s" , res .Message )
285
- }
286
- }
287
-
288
279
func getSignedByMSPMemberPolicy (mspID string ) ([]byte , error ) {
289
280
p := cauthdsl .SignedByMspMember (mspID )
290
281
@@ -332,33 +323,8 @@ func TestInvoke(t *testing.T) {
332
323
t .Fatalf ("vscc init failed with %s" , res .Message )
333
324
}
334
325
335
- // Failed path: Invalid arguments
336
- args := [][]byte {[]byte ("dv" )}
337
- if res := stub .MockInvoke ("1" , args ); res .Status == shim .OK {
338
- t .Fatalf ("vscc invoke should have failed" )
339
- }
340
-
341
- // not enough args
342
- args = [][]byte {[]byte ("dv" ), []byte ("tx" )}
343
- args [1 ] = nil
344
- if res := stub .MockInvoke ("1" , args ); res .Status == shim .OK {
345
- t .Fatalf ("vscc invoke should have failed" )
346
- }
347
-
348
- // nil args
349
- args = [][]byte {nil , nil , nil }
350
- if res := stub .MockInvoke ("1" , args ); res .Status == shim .OK {
351
- t .Fatalf ("vscc invoke should have failed" )
352
- }
353
-
354
- // nil args
355
- args = [][]byte {[]byte ("a" ), []byte ("a" ), nil }
356
- if res := stub .MockInvoke ("1" , args ); res .Status == shim .OK {
357
- t .Fatalf ("vscc invoke should have failed" )
358
- }
359
-
360
326
// broken Envelope
361
- args = [][]byte {[]byte ("a" ), []byte ("a" ), []byte ("a" )}
327
+ args : = [][]byte {[]byte ("a" ), []byte ("a" ), []byte ("a" )}
362
328
if res := stub .MockInvoke ("1" , args ); res .Status == shim .OK {
363
329
t .Fatalf ("vscc invoke should have failed" )
364
330
}
@@ -448,62 +414,6 @@ func TestInvoke(t *testing.T) {
448
414
}
449
415
}
450
416
451
- func TestInvalidFunction (t * testing.T ) {
452
- State := make (map [string ]map [string ][]byte )
453
- mp := (& scc.MocksccProviderFactory {
454
- Qe : lm .NewMockQueryExecutor (State ),
455
- ApplicationConfigBool : true ,
456
- ApplicationConfigRv : & mc.MockApplication {CapabilitiesRv : & mc.MockApplicationCapabilities {}},
457
- }).NewSystemChaincodeProvider ().(* scc.MocksccProviderImpl )
458
-
459
- v := New (mp )
460
- stub := shim .NewMockStub ("validatoronevalidsignature" , v )
461
-
462
- lccc := lscc .New (mp )
463
- stublccc := shim .NewMockStub ("lscc" , lccc )
464
- State ["lscc" ] = stublccc .State
465
- stub .MockPeerChaincode ("lscc" , stublccc )
466
-
467
- r1 := stub .MockInit ("1" , [][]byte {})
468
- if r1 .Status != shim .OK {
469
- fmt .Println ("Init failed" , string (r1 .Message ))
470
- t .FailNow ()
471
- }
472
-
473
- r := stublccc .MockInit ("1" , [][]byte {})
474
- if r .Status != shim .OK {
475
- fmt .Println ("Init failed" , string (r .Message ))
476
- t .FailNow ()
477
- }
478
-
479
- ccname := "mycc"
480
- ccver := "1"
481
-
482
- res , err := createCCDataRWset (ccname , ccname , ccver , nil )
483
- assert .NoError (t , err )
484
-
485
- tx , err := createLSCCTx (ccname , ccver , lscc .GETCCDATA , res )
486
- if err != nil {
487
- t .Fatalf ("createTx returned err %s" , err )
488
- }
489
-
490
- envBytes , err := utils .GetBytesEnvelope (tx )
491
- if err != nil {
492
- t .Fatalf ("GetBytesEnvelope returned err %s" , err )
493
- }
494
-
495
- // good path: signed by the right MSP
496
- policy , err := getSignedByMSPMemberPolicy (mspid )
497
- if err != nil {
498
- t .Fatalf ("failed getting policy, err %s" , err )
499
- }
500
-
501
- args := [][]byte {[]byte ("dv" ), envBytes , policy }
502
- if res := stub .MockInvoke ("1" , args ); res .Status == shim .OK {
503
- t .Fatalf ("vscc invoke should have failed" )
504
- }
505
- }
506
-
507
417
func TestRWSetTooBig (t * testing.T ) {
508
418
State := make (map [string ]map [string ][]byte )
509
419
mp := (& scc.MocksccProviderFactory {
0 commit comments