@@ -19,7 +19,6 @@ import (
1919 "github.com/hyperledger/fabric-config/protolator"
2020 "github.com/hyperledger/fabric-config/protolator/protoext/peerext"
2121 cb "github.com/hyperledger/fabric-protos-go/common"
22- mb "github.com/hyperledger/fabric-protos-go/msp"
2322 . "github.com/onsi/gomega"
2423)
2524
@@ -100,7 +99,7 @@ func TestNewApplicationGroup(t *testing.T) {
10099}
101100`
102101
103- applicationGroup , err := newApplicationGroup (application )
102+ applicationGroup , err := newApplicationGroupTemplate (application )
104103 gt .Expect (err ).NotTo (HaveOccurred ())
105104
106105 expectedApplication := & cb.ConfigGroup {}
@@ -199,7 +198,7 @@ func TestNewApplicationGroupFailure(t *testing.T) {
199198 application , _ := baseApplication (t )
200199 tt .applicationMod (& application )
201200
202- configGrp , err := newApplicationGroup (application )
201+ configGrp , err := newApplicationGroupTemplate (application )
203202 gt .Expect (err ).To (MatchError (tt .expectedErr ))
204203 gt .Expect (configGrp ).To (BeNil ())
205204 })
@@ -213,7 +212,7 @@ func TestAddAnchorPeer(t *testing.T) {
213212
214213 baseApplicationConf , _ := baseApplication (t )
215214
216- applicationGroup , err := newApplicationGroup (baseApplicationConf )
215+ applicationGroup , err := newApplicationGroupTemplate (baseApplicationConf )
217216 gt .Expect (err ).NotTo (HaveOccurred ())
218217
219218 config := & cb.Config {
@@ -376,7 +375,7 @@ func TestRemoveAnchorPeer(t *testing.T) {
376375
377376 baseApplicationConf , _ := baseApplication (t )
378377
379- applicationGroup , err := newApplicationGroup (baseApplicationConf )
378+ applicationGroup , err := newApplicationGroupTemplate (baseApplicationConf )
380379 gt .Expect (err ).NotTo (HaveOccurred ())
381380
382381 config := & cb.Config {
@@ -531,7 +530,7 @@ func TestRemoveAnchorPeerFailure(t *testing.T) {
531530
532531 baseApplicationConf , _ := baseApplication (t )
533532
534- applicationGroup , err := newApplicationGroup (baseApplicationConf )
533+ applicationGroup , err := newApplicationGroupTemplate (baseApplicationConf )
535534 gt .Expect (err ).NotTo (HaveOccurred ())
536535
537536 applicationGroup .Groups ["Org1" ].Values = tt .configValues
@@ -560,7 +559,7 @@ func TestAnchorPeers(t *testing.T) {
560559 channelGroup := newConfigGroup ()
561560
562561 application , _ := baseApplication (t )
563- applicationGroup , err := newApplicationGroup (application )
562+ applicationGroup , err := newApplicationGroupTemplate (application )
564563 gt .Expect (err ).NotTo (HaveOccurred ())
565564
566565 channelGroup .Groups [ApplicationGroupKey ] = applicationGroup
@@ -629,7 +628,7 @@ func TestSetACL(t *testing.T) {
629628
630629 channelGroup := newConfigGroup ()
631630 baseApplication , _ := baseApplication (t )
632- applicationGroup , err := newApplicationGroup (baseApplication )
631+ applicationGroup , err := newApplicationGroupTemplate (baseApplication )
633632
634633 channelGroup .Groups [ApplicationGroupKey ] = applicationGroup
635634 config := & cb.Config {
@@ -693,7 +692,7 @@ func TestRemoveACL(t *testing.T) {
693692 baseApplication , _ := baseApplication (t )
694693 baseApplication .ACLs ["acl2" ] = "acl2Value"
695694 baseApplication .ACLs ["acl3" ] = "acl3Value"
696- applicationGroup , err := newApplicationGroup (baseApplication )
695+ applicationGroup , err := newApplicationGroupTemplate (baseApplication )
697696
698697 channelGroup .Groups [ApplicationGroupKey ] = applicationGroup
699698 config := & cb.Config {
@@ -904,7 +903,7 @@ func TestSetApplicationOrgFailures(t *testing.T) {
904903 gt := NewGomegaWithT (t )
905904
906905 application , _ := baseApplication (t )
907- appGroup , err := newApplicationGroup (application )
906+ appGroup , err := newApplicationGroupTemplate (application )
908907 gt .Expect (err ).NotTo (HaveOccurred ())
909908
910909 config := & cb.Config {
@@ -930,7 +929,7 @@ func TestApplicationConfiguration(t *testing.T) {
930929 gt := NewGomegaWithT (t )
931930
932931 baseApplicationConf , _ := baseApplication (t )
933- applicationGroup , err := newApplicationGroup (baseApplicationConf )
932+ applicationGroup , err := newApplicationGroupTemplate (baseApplicationConf )
934933 gt .Expect (err ).NotTo (HaveOccurred ())
935934
936935 config := & cb.Config {
@@ -986,7 +985,7 @@ func TestApplicationConfigurationFailure(t *testing.T) {
986985 gt := NewGomegaWithT (t )
987986
988987 baseApplicationConf , _ := baseApplication (t )
989- applicationGroup , err := newApplicationGroup (baseApplicationConf )
988+ applicationGroup , err := newApplicationGroupTemplate (baseApplicationConf )
990989 gt .Expect (err ).NotTo (HaveOccurred ())
991990
992991 config := & cb.Config {
@@ -1016,7 +1015,7 @@ func TestApplicationACLs(t *testing.T) {
10161015 gt := NewGomegaWithT (t )
10171016
10181017 baseApplicationConf , _ := baseApplication (t )
1019- applicationGroup , err := newApplicationGroup (baseApplicationConf )
1018+ applicationGroup , err := newApplicationGroupTemplate (baseApplicationConf )
10201019 gt .Expect (err ).NotTo (HaveOccurred ())
10211020
10221021 config := & cb.Config {
@@ -1040,7 +1039,7 @@ func TestApplicationACLsFailure(t *testing.T) {
10401039 gt := NewGomegaWithT (t )
10411040
10421041 baseApplicationConf , _ := baseApplication (t )
1043- applicationGroup , err := newApplicationGroup (baseApplicationConf )
1042+ applicationGroup , err := newApplicationGroupTemplate (baseApplicationConf )
10441043 gt .Expect (err ).NotTo (HaveOccurred ())
10451044
10461045 config := & cb.Config {
@@ -1068,7 +1067,7 @@ func TestApplicationCapabilities(t *testing.T) {
10681067 gt := NewGomegaWithT (t )
10691068
10701069 baseApplicationConf , _ := baseApplication (t )
1071- applicationGroup , err := newApplicationGroup (baseApplicationConf )
1070+ applicationGroup , err := newApplicationGroupTemplate (baseApplicationConf )
10721071 gt .Expect (err ).NotTo (HaveOccurred ())
10731072
10741073 config := & cb.Config {
@@ -1277,7 +1276,7 @@ func TestAddApplicationCapability(t *testing.T) {
12771276 gt := NewGomegaWithT (t )
12781277
12791278 baseApp , _ := baseApplication (t )
1280- appGroup , err := newApplicationGroup (baseApp )
1279+ appGroup , err := newApplicationGroupTemplate (baseApp )
12811280 gt .Expect (err ).NotTo (HaveOccurred ())
12821281
12831282 config := & cb.Config {
@@ -1341,7 +1340,7 @@ func TestAddApplicationCapabilityFailures(t *testing.T) {
13411340 gt := NewGomegaWithT (t )
13421341
13431342 baseApp , _ := baseApplication (t )
1344- appGroup , err := newApplicationGroup (baseApp )
1343+ appGroup , err := newApplicationGroupTemplate (baseApp )
13451344 gt .Expect (err ).NotTo (HaveOccurred ())
13461345 tt .applicationGroup (appGroup )
13471346
@@ -1367,7 +1366,7 @@ func TestRemoveApplicationCapability(t *testing.T) {
13671366 gt := NewGomegaWithT (t )
13681367
13691368 baseApp , _ := baseApplication (t )
1370- appGroup , err := newApplicationGroup (baseApp )
1369+ appGroup , err := newApplicationGroupTemplate (baseApp )
13711370 gt .Expect (err ).NotTo (HaveOccurred ())
13721371
13731372 config := & cb.Config {
@@ -1505,7 +1504,7 @@ func TestRemoveApplicationCapabilityFailures(t *testing.T) {
15051504 gt := NewGomegaWithT (t )
15061505
15071506 baseApp , _ := baseApplication (t )
1508- appGroup , err := newApplicationGroup (baseApp )
1507+ appGroup , err := newApplicationGroupTemplate (baseApp )
15091508 gt .Expect (err ).NotTo (HaveOccurred ())
15101509 tt .applicationGroup (appGroup )
15111510
@@ -1743,7 +1742,7 @@ func TestSetApplicationPolicy(t *testing.T) {
17431742 channelGroup := newConfigGroup ()
17441743 application , _ := baseApplication (t )
17451744
1746- applicationGroup , err := newApplicationGroup (application )
1745+ applicationGroup , err := newApplicationGroupTemplate (application )
17471746 gt .Expect (err ).NotTo (HaveOccurred ())
17481747
17491748 channelGroup .Groups [ApplicationGroupKey ] = applicationGroup
@@ -1788,7 +1787,7 @@ func TestSetApplicationPolicyFailures(t *testing.T) {
17881787 channelGroup := newConfigGroup ()
17891788 application , _ := baseApplication (t )
17901789
1791- applicationGroup , err := newApplicationGroup (application )
1790+ applicationGroup , err := newApplicationGroupTemplate (application )
17921791 gt .Expect (err ).NotTo (HaveOccurred ())
17931792
17941793 channelGroup .Groups [ApplicationGroupKey ] = applicationGroup
@@ -1812,7 +1811,7 @@ func TestRemoveApplicationPolicy(t *testing.T) {
18121811 channelGroup := newConfigGroup ()
18131812 application , _ := baseApplication (t )
18141813
1815- applicationGroup , err := newApplicationGroup (application )
1814+ applicationGroup , err := newApplicationGroupTemplate (application )
18161815 gt .Expect (err ).NotTo (HaveOccurred ())
18171816 applicationGroup .Policies ["TestPolicy" ] = applicationGroup .Policies [AdminsPolicyKey ]
18181817
@@ -1854,7 +1853,7 @@ func TestRemoveApplicationPolicyFailures(t *testing.T) {
18541853 channelGroup := newConfigGroup ()
18551854 application , _ := baseApplication (t )
18561855
1857- applicationGroup , err := newApplicationGroup (application )
1856+ applicationGroup , err := newApplicationGroupTemplate (application )
18581857 gt .Expect (err ).NotTo (HaveOccurred ())
18591858
18601859 applicationGroup .Policies [EndorsementPolicyKey ] = & cb.ConfigPolicy {
@@ -1879,28 +1878,10 @@ func TestApplicationMSP(t *testing.T) {
18791878
18801879 gt := NewGomegaWithT (t )
18811880
1882- expectedMSP , _ := baseMSP (t )
1883-
18841881 application , _ := baseApplication (t )
18851882 applicationGroup , err := newApplicationGroup (application )
18861883 gt .Expect (err ).NotTo (HaveOccurred ())
18871884
1888- // We need to add the base MSP config to the base application since
1889- // newApplicationGroup doesn't apply MSP configuration
1890- applicationOrgGroup := applicationGroup .Groups ["Org1" ]
1891- fabricMSPConfig , err := expectedMSP .toProto ()
1892- gt .Expect (err ).NotTo (HaveOccurred ())
1893-
1894- conf , err := proto .Marshal (fabricMSPConfig )
1895- gt .Expect (err ).NotTo (HaveOccurred ())
1896-
1897- mspConfig := & mb.MSPConfig {
1898- Config : conf ,
1899- }
1900-
1901- err = setValue (applicationOrgGroup , mspValue (mspConfig ), AdminsPolicyKey )
1902- gt .Expect (err ).NotTo (HaveOccurred ())
1903-
19041885 config := & cb.Config {
19051886 ChannelGroup : & cb.ConfigGroup {
19061887 Groups : map [string ]* cb.ConfigGroup {
@@ -1913,7 +1894,7 @@ func TestApplicationMSP(t *testing.T) {
19131894
19141895 msp , err := c .Application ().Organization ("Org1" ).MSP ()
19151896 gt .Expect (err ).NotTo (HaveOccurred ())
1916- gt .Expect (msp ).To (Equal (expectedMSP ))
1897+ gt .Expect (msp ).To (Equal (application . Organizations [ 0 ]. MSP ))
19171898}
19181899
19191900func TestSetApplicationMSPFailure (t * testing.T ) {
0 commit comments