• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

mendersoftware / mender-server / 1494786857

14 Oct 2024 10:01AM UTC coverage: 72.891% (-1.2%) from 74.094%
1494786857

Pull #100

gitlab-ci

tranchitella
chore: centralize the mock generator across the different services

Changelog: None
Ticket: None

Signed-off-by: Fabio Tranchitella <fabio@tranchitella.eu>
Pull Request #100: chore: centralize the mock generator across the different services

4399 of 6347 branches covered (69.31%)

Branch coverage included in aggregate %.

722 of 2034 new or added lines in 44 files covered. (35.5%)

197 existing lines in 36 files now uncovered.

42530 of 58035 relevant lines covered (73.28%)

28.15 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

61.99
/backend/services/deviceconfig/store/mocks/DataStore.go
1
// Copyright 2021 Northern.tech AS
2
//
3
//    Licensed under the Apache License, Version 2.0 (the "License");
4
//    you may not use this file except in compliance with the License.
5
//    You may obtain a copy of the License at
6
//
7
//        http://www.apache.org/licenses/LICENSE-2.0
8
//
9
//    Unless required by applicable law or agreed to in writing, software
10
//    distributed under the License is distributed on an "AS IS" BASIS,
11
//    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
//    See the License for the specific language governing permissions and
13
//    limitations under the License.
14

15
// Code generated by mockery v2.45.1. DO NOT EDIT.
16

17
package mocks
18

19
import (
20
        context "context"
21

22
        model "github.com/mendersoftware/mender-server/services/deviceconfig/model"
23
        mock "github.com/stretchr/testify/mock"
24

25
        uuid "github.com/google/uuid"
26
)
27

28
// DataStore is an autogenerated mock type for the DataStore type
29
type DataStore struct {
30
        mock.Mock
31
}
32

33
// Close provides a mock function with given fields: ctx
34
func (_m *DataStore) Close(ctx context.Context) error {
×
35
        ret := _m.Called(ctx)
×
36

×
NEW
37
        if len(ret) == 0 {
×
NEW
38
                panic("no return value specified for Close")
×
39
        }
40

41
        var r0 error
×
42
        if rf, ok := ret.Get(0).(func(context.Context) error); ok {
×
43
                r0 = rf(ctx)
×
44
        } else {
×
45
                r0 = ret.Error(0)
×
46
        }
×
47

48
        return r0
×
49
}
50

51
// DeleteDevice provides a mock function with given fields: ctx, devID
52
func (_m *DataStore) DeleteDevice(ctx context.Context, devID string) error {
1✔
53
        ret := _m.Called(ctx, devID)
1✔
54

1✔
55
        if len(ret) == 0 {
1✔
NEW
56
                panic("no return value specified for DeleteDevice")
×
57
        }
58

59
        var r0 error
1✔
60
        if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
1✔
61
                r0 = rf(ctx, devID)
×
62
        } else {
1✔
63
                r0 = ret.Error(0)
1✔
64
        }
1✔
65

66
        return r0
1✔
67
}
68

69
// DeleteTenant provides a mock function with given fields: ctx, tenant_id
70
func (_m *DataStore) DeleteTenant(ctx context.Context, tenant_id string) error {
1✔
71
        ret := _m.Called(ctx, tenant_id)
1✔
72

1✔
73
        if len(ret) == 0 {
1✔
NEW
74
                panic("no return value specified for DeleteTenant")
×
75
        }
76

77
        var r0 error
1✔
78
        if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
1✔
79
                r0 = rf(ctx, tenant_id)
×
80
        } else {
1✔
81
                r0 = ret.Error(0)
1✔
82
        }
1✔
83

84
        return r0
1✔
85
}
86

87
// DropDatabase provides a mock function with given fields: ctx
88
func (_m *DataStore) DropDatabase(ctx context.Context) error {
×
89
        ret := _m.Called(ctx)
×
90

×
NEW
91
        if len(ret) == 0 {
×
NEW
92
                panic("no return value specified for DropDatabase")
×
93
        }
94

95
        var r0 error
×
96
        if rf, ok := ret.Get(0).(func(context.Context) error); ok {
×
97
                r0 = rf(ctx)
×
98
        } else {
×
99
                r0 = ret.Error(0)
×
100
        }
×
101

102
        return r0
×
103
}
104

105
// GetDevice provides a mock function with given fields: ctx, devID
106
func (_m *DataStore) GetDevice(ctx context.Context, devID string) (model.Device, error) {
1✔
107
        ret := _m.Called(ctx, devID)
1✔
108

1✔
109
        if len(ret) == 0 {
1✔
NEW
110
                panic("no return value specified for GetDevice")
×
111
        }
112

113
        var r0 model.Device
1✔
114
        var r1 error
1✔
115
        if rf, ok := ret.Get(0).(func(context.Context, string) (model.Device, error)); ok {
1✔
NEW
116
                return rf(ctx, devID)
×
NEW
117
        }
×
118
        if rf, ok := ret.Get(0).(func(context.Context, string) model.Device); ok {
1✔
119
                r0 = rf(ctx, devID)
×
120
        } else {
1✔
121
                r0 = ret.Get(0).(model.Device)
1✔
122
        }
1✔
123

124
        if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
1✔
UNCOV
125
                r1 = rf(ctx, devID)
×
126
        } else {
1✔
127
                r1 = ret.Error(1)
1✔
128
        }
1✔
129

130
        return r0, r1
1✔
131
}
132

133
// InsertDevice provides a mock function with given fields: ctx, dev
134
func (_m *DataStore) InsertDevice(ctx context.Context, dev model.Device) error {
1✔
135
        ret := _m.Called(ctx, dev)
1✔
136

1✔
137
        if len(ret) == 0 {
1✔
NEW
138
                panic("no return value specified for InsertDevice")
×
139
        }
140

141
        var r0 error
1✔
142
        if rf, ok := ret.Get(0).(func(context.Context, model.Device) error); ok {
1✔
143
                r0 = rf(ctx, dev)
×
144
        } else {
1✔
145
                r0 = ret.Error(0)
1✔
146
        }
1✔
147

148
        return r0
1✔
149
}
150

151
// Migrate provides a mock function with given fields: ctx, version, automigrate
152
func (_m *DataStore) Migrate(ctx context.Context, version string, automigrate bool) error {
×
153
        ret := _m.Called(ctx, version, automigrate)
×
154

×
NEW
155
        if len(ret) == 0 {
×
NEW
156
                panic("no return value specified for Migrate")
×
157
        }
158

159
        var r0 error
×
160
        if rf, ok := ret.Get(0).(func(context.Context, string, bool) error); ok {
×
161
                r0 = rf(ctx, version, automigrate)
×
162
        } else {
×
163
                r0 = ret.Error(0)
×
164
        }
×
165

166
        return r0
×
167
}
168

169
// MigrateLatest provides a mock function with given fields: ctx
170
func (_m *DataStore) MigrateLatest(ctx context.Context) error {
1✔
171
        ret := _m.Called(ctx)
1✔
172

1✔
173
        if len(ret) == 0 {
1✔
NEW
174
                panic("no return value specified for MigrateLatest")
×
175
        }
176

177
        var r0 error
1✔
178
        if rf, ok := ret.Get(0).(func(context.Context) error); ok {
1✔
179
                r0 = rf(ctx)
×
180
        } else {
1✔
181
                r0 = ret.Error(0)
1✔
182
        }
1✔
183

184
        return r0
1✔
185
}
186

187
// Ping provides a mock function with given fields: ctx
188
func (_m *DataStore) Ping(ctx context.Context) error {
1✔
189
        ret := _m.Called(ctx)
1✔
190

1✔
191
        if len(ret) == 0 {
1✔
NEW
192
                panic("no return value specified for Ping")
×
193
        }
194

195
        var r0 error
1✔
196
        if rf, ok := ret.Get(0).(func(context.Context) error); ok {
1✔
197
                r0 = rf(ctx)
×
198
        } else {
1✔
199
                r0 = ret.Error(0)
1✔
200
        }
1✔
201

202
        return r0
1✔
203
}
204

205
// ReplaceConfiguration provides a mock function with given fields: ctx, dev
206
func (_m *DataStore) ReplaceConfiguration(ctx context.Context, dev model.Device) error {
1✔
207
        ret := _m.Called(ctx, dev)
1✔
208

1✔
209
        if len(ret) == 0 {
1✔
NEW
210
                panic("no return value specified for ReplaceConfiguration")
×
211
        }
212

213
        var r0 error
1✔
214
        if rf, ok := ret.Get(0).(func(context.Context, model.Device) error); ok {
1✔
215
                r0 = rf(ctx, dev)
×
216
        } else {
1✔
217
                r0 = ret.Error(0)
1✔
218
        }
1✔
219

220
        return r0
1✔
221
}
222

223
// ReplaceReportedConfiguration provides a mock function with given fields: ctx, dev
224
func (_m *DataStore) ReplaceReportedConfiguration(ctx context.Context, dev model.Device) error {
1✔
225
        ret := _m.Called(ctx, dev)
1✔
226

1✔
227
        if len(ret) == 0 {
1✔
NEW
228
                panic("no return value specified for ReplaceReportedConfiguration")
×
229
        }
230

231
        var r0 error
1✔
232
        if rf, ok := ret.Get(0).(func(context.Context, model.Device) error); ok {
1✔
233
                r0 = rf(ctx, dev)
×
234
        } else {
1✔
235
                r0 = ret.Error(0)
1✔
236
        }
1✔
237

238
        return r0
1✔
239
}
240

241
// SetDeploymentID provides a mock function with given fields: ctx, devID, deploymentID
242
func (_m *DataStore) SetDeploymentID(ctx context.Context, devID string, deploymentID uuid.UUID) error {
1✔
243
        ret := _m.Called(ctx, devID, deploymentID)
1✔
244

1✔
245
        if len(ret) == 0 {
1✔
NEW
246
                panic("no return value specified for SetDeploymentID")
×
247
        }
248

249
        var r0 error
1✔
250
        if rf, ok := ret.Get(0).(func(context.Context, string, uuid.UUID) error); ok {
1✔
251
                r0 = rf(ctx, devID, deploymentID)
×
252
        } else {
1✔
253
                r0 = ret.Error(0)
1✔
254
        }
1✔
255

256
        return r0
1✔
257
}
258

259
// UpdateConfiguration provides a mock function with given fields: ctx, deviceID, attrs
260
func (_m *DataStore) UpdateConfiguration(ctx context.Context, deviceID string, attrs model.Attributes) error {
1✔
261
        ret := _m.Called(ctx, deviceID, attrs)
1✔
262

1✔
263
        if len(ret) == 0 {
1✔
NEW
264
                panic("no return value specified for UpdateConfiguration")
×
265
        }
266

267
        var r0 error
1✔
268
        if rf, ok := ret.Get(0).(func(context.Context, string, model.Attributes) error); ok {
1✔
269
                r0 = rf(ctx, deviceID, attrs)
×
270
        } else {
1✔
271
                r0 = ret.Error(0)
1✔
272
        }
1✔
273

274
        return r0
1✔
275
}
276

277
// NewDataStore creates a new instance of DataStore. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
278
// The first argument is typically a *testing.T value.
279
func NewDataStore(t interface {
280
        mock.TestingT
281
        Cleanup(func())
NEW
282
}) *DataStore {
×
NEW
283
        mock := &DataStore{}
×
NEW
284
        mock.Mock.Test(t)
×
NEW
285

×
NEW
286
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
287

NEW
288
        return mock
×
289
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc