-
Notifications
You must be signed in to change notification settings - Fork 6
/
mocks.go
130 lines (100 loc) · 2.72 KB
/
mocks.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
/*
Copyright IBM Corp. All Rights Reserved.
SPDX-License-Identifier: Apache-2.0
*/
package mocks
import (
"time"
"github.com/hyperledger/fabric/msp"
pmsp "github.com/hyperledger/fabric/protos/msp"
"github.com/stretchr/testify/mock"
)
type MockMSP struct {
mock.Mock
}
func (m *MockMSP) IsWellFormed(_ *pmsp.SerializedIdentity) error {
return nil
}
func (m *MockMSP) DeserializeIdentity(serializedIdentity []byte) (msp.Identity, error) {
args := m.Called(serializedIdentity)
return args.Get(0).(msp.Identity), args.Error(1)
}
func (m *MockMSP) Setup(config *pmsp.MSPConfig) error {
args := m.Called(config)
return args.Error(0)
}
func (m *MockMSP) GetVersion() msp.MSPVersion {
args := m.Called()
return args.Get(0).(msp.MSPVersion)
}
func (m *MockMSP) GetType() msp.ProviderType {
args := m.Called()
return args.Get(0).(msp.ProviderType)
}
func (m *MockMSP) GetIdentifier() (string, error) {
args := m.Called()
return args.String(0), args.Error(1)
}
func (m *MockMSP) GetSigningIdentity(identifier *msp.IdentityIdentifier) (msp.SigningIdentity, error) {
args := m.Called(identifier)
return args.Get(0).(msp.SigningIdentity), args.Error(1)
}
func (m *MockMSP) GetDefaultSigningIdentity() (msp.SigningIdentity, error) {
args := m.Called()
return args.Get(0).(msp.SigningIdentity), args.Error(1)
}
func (m *MockMSP) GetTLSRootCerts() [][]byte {
args := m.Called()
return args.Get(0).([][]byte)
}
func (m *MockMSP) GetTLSIntermediateCerts() [][]byte {
args := m.Called()
return args.Get(0).([][]byte)
}
func (m *MockMSP) Validate(id msp.Identity) error {
args := m.Called(id)
return args.Error(0)
}
func (m *MockMSP) SatisfiesPrincipal(id msp.Identity, principal *pmsp.MSPPrincipal) error {
args := m.Called(id, principal)
return args.Error(0)
}
type MockIdentity struct {
mock.Mock
ID string
}
func (m *MockIdentity) ExpiresAt() time.Time {
panic("implement me")
}
func (m *MockIdentity) GetIdentifier() *msp.IdentityIdentifier {
args := m.Called()
return args.Get(0).(*msp.IdentityIdentifier)
}
func (*MockIdentity) GetMSPIdentifier() string {
panic("implement me")
}
func (*MockIdentity) Validate() error {
panic("implement me")
}
func (*MockIdentity) GetOrganizationalUnits() []*msp.OUIdentifier {
panic("implement me")
}
func (*MockIdentity) Verify(msg []byte, sig []byte) error {
panic("implement me")
}
func (*MockIdentity) Serialize() ([]byte, error) {
panic("implement me")
}
func (*MockIdentity) SatisfiesPrincipal(principal *pmsp.MSPPrincipal) error {
panic("implement me")
}
type MockSigningIdentity struct {
mock.Mock
*MockIdentity
}
func (*MockSigningIdentity) Sign(msg []byte) ([]byte, error) {
panic("implement me")
}
func (*MockSigningIdentity) GetPublicVersion() msp.Identity {
panic("implement me")
}