Commit 55aec5e Jason Yellick
committed
1 parent 01de0e4 commit 55aec5e Copy full SHA for 55aec5e
File tree 2 files changed +74
-0
lines changed
2 files changed +74
-0
lines changed Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright IBM Corp. 2016 All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ package policies
18
+
19
+ import (
20
+ "github.com/hyperledger/fabric/common/policies"
21
+ cb "github.com/hyperledger/fabric/protos/common"
22
+ )
23
+
24
+ // Policy is a mock implementation of the policies.Policy interface
25
+ type Policy struct {
26
+ Err error
27
+ }
28
+
29
+ // Evaluate returns the Err set in Policy
30
+ func (p * Policy ) Evaluate (signatureSet []* cb.SignedData ) error {
31
+ return p .Err
32
+ }
33
+
34
+ // Manager is a mock implementation of the policies.Manager interface
35
+ type Manager struct {
36
+ // Policy is returned as the output to GetPolicy
37
+ Policy * Policy
38
+ }
39
+
40
+ // GetPolicy returns the value of Manager.Policy and whether it was nil or not
41
+ func (m * Manager ) GetPolicy (id string ) (policies.Policy , bool ) {
42
+ return m .Policy , m .Policy != nil
43
+ }
Original file line number Diff line number Diff line change
1
+ /*
2
+ Copyright IBM Corp. 2016 All Rights Reserved.
3
+
4
+ Licensed under the Apache License, Version 2.0 (the "License");
5
+ you may not use this file except in compliance with the License.
6
+ You may obtain a copy of the License at
7
+
8
+ http://www.apache.org/licenses/LICENSE-2.0
9
+
10
+ Unless required by applicable law or agreed to in writing, software
11
+ distributed under the License is distributed on an "AS IS" BASIS,
12
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13
+ See the License for the specific language governing permissions and
14
+ limitations under the License.
15
+ */
16
+
17
+ package policies
18
+
19
+ import (
20
+ "testing"
21
+
22
+ "github.com/hyperledger/fabric/common/policies"
23
+ )
24
+
25
+ func TestPolicyManagerInterface (t * testing.T ) {
26
+ _ = policies .Manager (& Manager {})
27
+ }
28
+
29
+ func TestPolicyInterface (t * testing.T ) {
30
+ _ = policies .Policy (& Policy {})
31
+ }
You can’t perform that action at this time.
0 commit comments