This repository was archived by the owner on Oct 26, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathclient_mock.go
135 lines (98 loc) · 3.37 KB
/
client_mock.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
131
132
133
134
135
package schemaregistry
import (
"context"
"github.com/stretchr/testify/mock"
)
// ClientMock is a mock implementation of Client.
type ClientMock struct {
mock.Mock
}
// GetSchemaByID method mock
func (c *ClientMock) GetSchemaByID(ctx context.Context, subjectID int) (string, error) {
args := c.Called(subjectID)
return args.String(0), args.Error(1)
}
// Subjects method mock
func (c *ClientMock) Subjects(ctx context.Context) (subjects []string, err error) {
args := c.Called()
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).([]string), args.Error(1)
}
// Versions method mock
func (c *ClientMock) Versions(ctx context.Context, subject string) (versions []int, err error) {
args := c.Called(subject)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).([]int), args.Error(1)
}
// DeleteSubject method mock
func (c *ClientMock) DeleteSubject(ctx context.Context, subject string, permanent bool) (versions []int, err error) {
args := c.Called(subject, permanent)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).([]int), args.Error(1)
}
// IsRegistered method mock
func (c *ClientMock) IsRegistered(ctx context.Context, subject string, schema string) (bool, *Schema, error) {
args := c.Called(subject, schema)
if args.Get(1) == nil {
return args.Bool(0), nil, args.Error(2)
}
return args.Bool(0), args.Get(1).(*Schema), args.Error(2)
}
// RegisterNewSchema method mock
func (c *ClientMock) RegisterNewSchema(ctx context.Context, subject string, avroSchema string) (int, error) {
args := c.Called(subject, avroSchema)
return args.Int(0), args.Error(1)
}
// GetSchemaBySubjectAndVersion method mock
func (c *ClientMock) GetSchemaBySubjectAndVersion(ctx context.Context, subject string, version int) (*Schema, error) {
args := c.Called(subject, version)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*Schema), args.Error(1)
}
// GetLatestSchema method mock
func (c *ClientMock) GetLatestSchema(ctx context.Context, subject string) (*Schema, error) {
args := c.Called(subject)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*Schema), args.Error(1)
}
// GetConfig method mock
func (c *ClientMock) GetConfig(ctx context.Context, subject string) (*Config, error) {
args := c.Called(subject)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*Config), args.Error(1)
}
// DeleteSchemaVersion method mock
func (c *ClientMock) DeleteSchemaVersion(ctx context.Context, subject string, version int, permanent bool) (int, error) {
args := c.Called(subject, version, permanent)
return args.Int(0), args.Error(1)
}
// DeleteLatestSchemaVersion method mock
func (c *ClientMock) DeleteLatestSchemaVersion(ctx context.Context, subject string, permanent bool) (int, error) {
args := c.Called(subject, permanent)
return args.Int(0), args.Error(1)
}
// SchemaCompatibleWith method mock
func (c *ClientMock) SchemaCompatibleWith(ctx context.Context, schema string, subject string, version int) (bool, error) {
args := c.Called(schema, subject, version)
return args.Bool(0), args.Error(1)
}
// SetGlobalConfig method mock.
func (c *ClientMock) SetGlobalConfig(ctx context.Context, config Config) (*Config, error) {
args := c.Called(config)
if args.Get(0) == nil {
return nil, args.Error(1)
}
return args.Get(0).(*Config), args.Error(1)
}