• 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

68.52
/backend/services/inventory/store/mocks/DataStore.go
1
// Copyright 2023 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/inventory/model"
23
        mock "github.com/stretchr/testify/mock"
24

25
        store "github.com/mendersoftware/mender-server/services/inventory/store"
26
)
27

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

33
// AddDevice provides a mock function with given fields: ctx, dev
34
func (_m *DataStore) AddDevice(ctx context.Context, dev *model.Device) error {
1✔
35
        ret := _m.Called(ctx, dev)
1✔
36

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

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

48
        return r0
1✔
49
}
50

51
// DeleteDevices provides a mock function with given fields: ctx, ids
52
func (_m *DataStore) DeleteDevices(ctx context.Context, ids []model.DeviceID) (*model.UpdateResult, error) {
1✔
53
        ret := _m.Called(ctx, ids)
1✔
54

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

59
        var r0 *model.UpdateResult
1✔
60
        var r1 error
1✔
61
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID) (*model.UpdateResult, error)); ok {
1✔
NEW
62
                return rf(ctx, ids)
×
NEW
63
        }
×
64
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID) *model.UpdateResult); ok {
1✔
65
                r0 = rf(ctx, ids)
×
66
        } else {
1✔
67
                if ret.Get(0) != nil {
2✔
68
                        r0 = ret.Get(0).(*model.UpdateResult)
1✔
69
                }
1✔
70
        }
71

72
        if rf, ok := ret.Get(1).(func(context.Context, []model.DeviceID) error); ok {
1✔
UNCOV
73
                r1 = rf(ctx, ids)
×
74
        } else {
1✔
75
                r1 = ret.Error(1)
1✔
76
        }
1✔
77

78
        return r0, r1
1✔
79
}
80

81
// DeleteGroup provides a mock function with given fields: ctx, group
82
func (_m *DataStore) DeleteGroup(ctx context.Context, group model.GroupName) (chan model.DeviceID, error) {
1✔
83
        ret := _m.Called(ctx, group)
1✔
84

1✔
85
        if len(ret) == 0 {
1✔
NEW
86
                panic("no return value specified for DeleteGroup")
×
87
        }
88

89
        var r0 chan model.DeviceID
1✔
90
        var r1 error
1✔
91
        if rf, ok := ret.Get(0).(func(context.Context, model.GroupName) (chan model.DeviceID, error)); ok {
1✔
NEW
92
                return rf(ctx, group)
×
NEW
93
        }
×
94
        if rf, ok := ret.Get(0).(func(context.Context, model.GroupName) chan model.DeviceID); ok {
1✔
95
                r0 = rf(ctx, group)
×
96
        } else {
1✔
97
                if ret.Get(0) != nil {
2✔
98
                        r0 = ret.Get(0).(chan model.DeviceID)
1✔
99
                }
1✔
100
        }
101

102
        if rf, ok := ret.Get(1).(func(context.Context, model.GroupName) error); ok {
1✔
UNCOV
103
                r1 = rf(ctx, group)
×
104
        } else {
1✔
105
                r1 = ret.Error(1)
1✔
106
        }
1✔
107

108
        return r0, r1
1✔
109
}
110

111
// GetAllAttributeNames provides a mock function with given fields: ctx
112
func (_m *DataStore) GetAllAttributeNames(ctx context.Context) ([]string, error) {
×
113
        ret := _m.Called(ctx)
×
114

×
NEW
115
        if len(ret) == 0 {
×
NEW
116
                panic("no return value specified for GetAllAttributeNames")
×
117
        }
118

119
        var r0 []string
×
NEW
120
        var r1 error
×
NEW
121
        if rf, ok := ret.Get(0).(func(context.Context) ([]string, error)); ok {
×
NEW
122
                return rf(ctx)
×
NEW
123
        }
×
124
        if rf, ok := ret.Get(0).(func(context.Context) []string); ok {
×
125
                r0 = rf(ctx)
×
126
        } else {
×
127
                if ret.Get(0) != nil {
×
128
                        r0 = ret.Get(0).([]string)
×
129
                }
×
130
        }
131

132
        if rf, ok := ret.Get(1).(func(context.Context) error); ok {
×
133
                r1 = rf(ctx)
×
134
        } else {
×
135
                r1 = ret.Error(1)
×
136
        }
×
137

138
        return r0, r1
×
139
}
140

141
// GetDevice provides a mock function with given fields: ctx, id
142
func (_m *DataStore) GetDevice(ctx context.Context, id model.DeviceID) (*model.Device, error) {
1✔
143
        ret := _m.Called(ctx, id)
1✔
144

1✔
145
        if len(ret) == 0 {
1✔
NEW
146
                panic("no return value specified for GetDevice")
×
147
        }
148

149
        var r0 *model.Device
1✔
150
        var r1 error
1✔
151
        if rf, ok := ret.Get(0).(func(context.Context, model.DeviceID) (*model.Device, error)); ok {
1✔
NEW
152
                return rf(ctx, id)
×
NEW
153
        }
×
154
        if rf, ok := ret.Get(0).(func(context.Context, model.DeviceID) *model.Device); ok {
1✔
155
                r0 = rf(ctx, id)
×
156
        } else {
1✔
157
                if ret.Get(0) != nil {
2✔
158
                        r0 = ret.Get(0).(*model.Device)
1✔
159
                }
1✔
160
        }
161

162
        if rf, ok := ret.Get(1).(func(context.Context, model.DeviceID) error); ok {
1✔
UNCOV
163
                r1 = rf(ctx, id)
×
164
        } else {
1✔
165
                r1 = ret.Error(1)
1✔
166
        }
1✔
167

168
        return r0, r1
1✔
169
}
170

171
// GetDeviceGroup provides a mock function with given fields: ctx, id
172
func (_m *DataStore) GetDeviceGroup(ctx context.Context, id model.DeviceID) (model.GroupName, error) {
1✔
173
        ret := _m.Called(ctx, id)
1✔
174

1✔
175
        if len(ret) == 0 {
1✔
NEW
176
                panic("no return value specified for GetDeviceGroup")
×
177
        }
178

179
        var r0 model.GroupName
1✔
180
        var r1 error
1✔
181
        if rf, ok := ret.Get(0).(func(context.Context, model.DeviceID) (model.GroupName, error)); ok {
1✔
NEW
182
                return rf(ctx, id)
×
NEW
183
        }
×
184
        if rf, ok := ret.Get(0).(func(context.Context, model.DeviceID) model.GroupName); ok {
1✔
185
                r0 = rf(ctx, id)
×
186
        } else {
1✔
187
                r0 = ret.Get(0).(model.GroupName)
1✔
188
        }
1✔
189

190
        if rf, ok := ret.Get(1).(func(context.Context, model.DeviceID) error); ok {
1✔
UNCOV
191
                r1 = rf(ctx, id)
×
192
        } else {
1✔
193
                r1 = ret.Error(1)
1✔
194
        }
1✔
195

196
        return r0, r1
1✔
197
}
198

199
// GetDevices provides a mock function with given fields: ctx, q
200
func (_m *DataStore) GetDevices(ctx context.Context, q store.ListQuery) ([]model.Device, int, error) {
1✔
201
        ret := _m.Called(ctx, q)
1✔
202

1✔
203
        if len(ret) == 0 {
1✔
NEW
204
                panic("no return value specified for GetDevices")
×
205
        }
206

207
        var r0 []model.Device
1✔
208
        var r1 int
1✔
209
        var r2 error
1✔
210
        if rf, ok := ret.Get(0).(func(context.Context, store.ListQuery) ([]model.Device, int, error)); ok {
1✔
NEW
211
                return rf(ctx, q)
×
NEW
212
        }
×
213
        if rf, ok := ret.Get(0).(func(context.Context, store.ListQuery) []model.Device); ok {
1✔
214
                r0 = rf(ctx, q)
×
215
        } else {
1✔
216
                if ret.Get(0) != nil {
2✔
217
                        r0 = ret.Get(0).([]model.Device)
1✔
218
                }
1✔
219
        }
220

221
        if rf, ok := ret.Get(1).(func(context.Context, store.ListQuery) int); ok {
1✔
UNCOV
222
                r1 = rf(ctx, q)
×
223
        } else {
1✔
224
                r1 = ret.Get(1).(int)
1✔
225
        }
1✔
226

227
        if rf, ok := ret.Get(2).(func(context.Context, store.ListQuery) error); ok {
1✔
UNCOV
228
                r2 = rf(ctx, q)
×
229
        } else {
1✔
230
                r2 = ret.Error(2)
1✔
231
        }
1✔
232

233
        return r0, r1, r2
1✔
234
}
235

236
// GetDevicesByGroup provides a mock function with given fields: ctx, group, skip, limit
237
func (_m *DataStore) GetDevicesByGroup(ctx context.Context, group model.GroupName, skip int, limit int) ([]model.DeviceID, int, error) {
1✔
238
        ret := _m.Called(ctx, group, skip, limit)
1✔
239

1✔
240
        if len(ret) == 0 {
1✔
NEW
241
                panic("no return value specified for GetDevicesByGroup")
×
242
        }
243

244
        var r0 []model.DeviceID
1✔
245
        var r1 int
1✔
246
        var r2 error
1✔
247
        if rf, ok := ret.Get(0).(func(context.Context, model.GroupName, int, int) ([]model.DeviceID, int, error)); ok {
1✔
NEW
248
                return rf(ctx, group, skip, limit)
×
NEW
249
        }
×
250
        if rf, ok := ret.Get(0).(func(context.Context, model.GroupName, int, int) []model.DeviceID); ok {
1✔
251
                r0 = rf(ctx, group, skip, limit)
×
252
        } else {
1✔
253
                if ret.Get(0) != nil {
2✔
254
                        r0 = ret.Get(0).([]model.DeviceID)
1✔
255
                }
1✔
256
        }
257

258
        if rf, ok := ret.Get(1).(func(context.Context, model.GroupName, int, int) int); ok {
1✔
UNCOV
259
                r1 = rf(ctx, group, skip, limit)
×
260
        } else {
1✔
261
                r1 = ret.Get(1).(int)
1✔
262
        }
1✔
263

264
        if rf, ok := ret.Get(2).(func(context.Context, model.GroupName, int, int) error); ok {
1✔
UNCOV
265
                r2 = rf(ctx, group, skip, limit)
×
266
        } else {
1✔
267
                r2 = ret.Error(2)
1✔
268
        }
1✔
269

270
        return r0, r1, r2
1✔
271
}
272

273
// GetFiltersAttributes provides a mock function with given fields: ctx
274
func (_m *DataStore) GetFiltersAttributes(ctx context.Context) ([]model.FilterAttribute, error) {
1✔
275
        ret := _m.Called(ctx)
1✔
276

1✔
277
        if len(ret) == 0 {
1✔
NEW
278
                panic("no return value specified for GetFiltersAttributes")
×
279
        }
280

281
        var r0 []model.FilterAttribute
1✔
282
        var r1 error
1✔
283
        if rf, ok := ret.Get(0).(func(context.Context) ([]model.FilterAttribute, error)); ok {
1✔
NEW
284
                return rf(ctx)
×
NEW
285
        }
×
286
        if rf, ok := ret.Get(0).(func(context.Context) []model.FilterAttribute); ok {
1✔
287
                r0 = rf(ctx)
×
288
        } else {
1✔
289
                if ret.Get(0) != nil {
2✔
290
                        r0 = ret.Get(0).([]model.FilterAttribute)
1✔
291
                }
1✔
292
        }
293

294
        if rf, ok := ret.Get(1).(func(context.Context) error); ok {
1✔
UNCOV
295
                r1 = rf(ctx)
×
296
        } else {
1✔
297
                r1 = ret.Error(1)
1✔
298
        }
1✔
299

300
        return r0, r1
1✔
301
}
302

303
// ListGroups provides a mock function with given fields: ctx, filters
304
func (_m *DataStore) ListGroups(ctx context.Context, filters []model.FilterPredicate) ([]model.GroupName, error) {
1✔
305
        ret := _m.Called(ctx, filters)
1✔
306

1✔
307
        if len(ret) == 0 {
1✔
NEW
308
                panic("no return value specified for ListGroups")
×
309
        }
310

311
        var r0 []model.GroupName
1✔
312
        var r1 error
1✔
313
        if rf, ok := ret.Get(0).(func(context.Context, []model.FilterPredicate) ([]model.GroupName, error)); ok {
1✔
NEW
314
                return rf(ctx, filters)
×
NEW
315
        }
×
316
        if rf, ok := ret.Get(0).(func(context.Context, []model.FilterPredicate) []model.GroupName); ok {
1✔
317
                r0 = rf(ctx, filters)
×
318
        } else {
1✔
319
                if ret.Get(0) != nil {
2✔
320
                        r0 = ret.Get(0).([]model.GroupName)
1✔
321
                }
1✔
322
        }
323

324
        if rf, ok := ret.Get(1).(func(context.Context, []model.FilterPredicate) error); ok {
1✔
UNCOV
325
                r1 = rf(ctx, filters)
×
326
        } else {
1✔
327
                r1 = ret.Error(1)
1✔
328
        }
1✔
329

330
        return r0, r1
1✔
331
}
332

333
// Maintenance provides a mock function with given fields: ctx, version, tenantIDs
334
func (_m *DataStore) Maintenance(ctx context.Context, version string, tenantIDs ...string) error {
×
335
        _va := make([]interface{}, len(tenantIDs))
×
336
        for _i := range tenantIDs {
×
337
                _va[_i] = tenantIDs[_i]
×
338
        }
×
339
        var _ca []interface{}
×
340
        _ca = append(_ca, ctx, version)
×
341
        _ca = append(_ca, _va...)
×
342
        ret := _m.Called(_ca...)
×
343

×
NEW
344
        if len(ret) == 0 {
×
NEW
345
                panic("no return value specified for Maintenance")
×
346
        }
347

348
        var r0 error
×
349
        if rf, ok := ret.Get(0).(func(context.Context, string, ...string) error); ok {
×
350
                r0 = rf(ctx, version, tenantIDs...)
×
351
        } else {
×
352
                r0 = ret.Error(0)
×
353
        }
×
354

355
        return r0
×
356
}
357

358
// Migrate provides a mock function with given fields: ctx, version
359
func (_m *DataStore) Migrate(ctx context.Context, version string) error {
×
360
        ret := _m.Called(ctx, version)
×
361

×
NEW
362
        if len(ret) == 0 {
×
NEW
363
                panic("no return value specified for Migrate")
×
364
        }
365

366
        var r0 error
×
367
        if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
×
368
                r0 = rf(ctx, version)
×
369
        } else {
×
370
                r0 = ret.Error(0)
×
371
        }
×
372

373
        return r0
×
374
}
375

376
// MigrateTenant provides a mock function with given fields: ctx, version, tenantId
377
func (_m *DataStore) MigrateTenant(ctx context.Context, version string, tenantId string) error {
1✔
378
        ret := _m.Called(ctx, version, tenantId)
1✔
379

1✔
380
        if len(ret) == 0 {
1✔
NEW
381
                panic("no return value specified for MigrateTenant")
×
382
        }
383

384
        var r0 error
1✔
385
        if rf, ok := ret.Get(0).(func(context.Context, string, string) error); ok {
1✔
386
                r0 = rf(ctx, version, tenantId)
×
387
        } else {
1✔
388
                r0 = ret.Error(0)
1✔
389
        }
1✔
390

391
        return r0
1✔
392
}
393

394
// Ping provides a mock function with given fields: ctx
395
func (_m *DataStore) Ping(ctx context.Context) error {
1✔
396
        ret := _m.Called(ctx)
1✔
397

1✔
398
        if len(ret) == 0 {
1✔
NEW
399
                panic("no return value specified for Ping")
×
400
        }
401

402
        var r0 error
1✔
403
        if rf, ok := ret.Get(0).(func(context.Context) error); ok {
1✔
404
                r0 = rf(ctx)
×
405
        } else {
1✔
406
                r0 = ret.Error(0)
1✔
407
        }
1✔
408

409
        return r0
1✔
410
}
411

412
// SearchDevices provides a mock function with given fields: ctx, searchParams
413
func (_m *DataStore) SearchDevices(ctx context.Context, searchParams model.SearchParams) ([]model.Device, int, error) {
1✔
414
        ret := _m.Called(ctx, searchParams)
1✔
415

1✔
416
        if len(ret) == 0 {
1✔
NEW
417
                panic("no return value specified for SearchDevices")
×
418
        }
419

420
        var r0 []model.Device
1✔
421
        var r1 int
1✔
422
        var r2 error
1✔
423
        if rf, ok := ret.Get(0).(func(context.Context, model.SearchParams) ([]model.Device, int, error)); ok {
1✔
NEW
424
                return rf(ctx, searchParams)
×
NEW
425
        }
×
426
        if rf, ok := ret.Get(0).(func(context.Context, model.SearchParams) []model.Device); ok {
1✔
427
                r0 = rf(ctx, searchParams)
×
428
        } else {
1✔
429
                if ret.Get(0) != nil {
2✔
430
                        r0 = ret.Get(0).([]model.Device)
1✔
431
                }
1✔
432
        }
433

434
        if rf, ok := ret.Get(1).(func(context.Context, model.SearchParams) int); ok {
1✔
UNCOV
435
                r1 = rf(ctx, searchParams)
×
436
        } else {
1✔
437
                r1 = ret.Get(1).(int)
1✔
438
        }
1✔
439

440
        if rf, ok := ret.Get(2).(func(context.Context, model.SearchParams) error); ok {
1✔
UNCOV
441
                r2 = rf(ctx, searchParams)
×
442
        } else {
1✔
443
                r2 = ret.Error(2)
1✔
444
        }
1✔
445

446
        return r0, r1, r2
1✔
447
}
448

449
// UnsetDevicesGroup provides a mock function with given fields: ctx, deviceIDs, group
450
func (_m *DataStore) UnsetDevicesGroup(ctx context.Context, deviceIDs []model.DeviceID, group model.GroupName) (*model.UpdateResult, error) {
1✔
451
        ret := _m.Called(ctx, deviceIDs, group)
1✔
452

1✔
453
        if len(ret) == 0 {
1✔
NEW
454
                panic("no return value specified for UnsetDevicesGroup")
×
455
        }
456

457
        var r0 *model.UpdateResult
1✔
458
        var r1 error
1✔
459
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID, model.GroupName) (*model.UpdateResult, error)); ok {
1✔
NEW
460
                return rf(ctx, deviceIDs, group)
×
NEW
461
        }
×
462
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID, model.GroupName) *model.UpdateResult); ok {
1✔
463
                r0 = rf(ctx, deviceIDs, group)
×
464
        } else {
1✔
465
                if ret.Get(0) != nil {
2✔
466
                        r0 = ret.Get(0).(*model.UpdateResult)
1✔
467
                }
1✔
468
        }
469

470
        if rf, ok := ret.Get(1).(func(context.Context, []model.DeviceID, model.GroupName) error); ok {
1✔
UNCOV
471
                r1 = rf(ctx, deviceIDs, group)
×
472
        } else {
1✔
473
                r1 = ret.Error(1)
1✔
474
        }
1✔
475

476
        return r0, r1
1✔
477
}
478

479
// UpdateDeviceText provides a mock function with given fields: ctx, id, text
480
func (_m *DataStore) UpdateDeviceText(ctx context.Context, id model.DeviceID, text string) error {
1✔
481
        ret := _m.Called(ctx, id, text)
1✔
482

1✔
483
        if len(ret) == 0 {
1✔
NEW
484
                panic("no return value specified for UpdateDeviceText")
×
485
        }
486

487
        var r0 error
1✔
488
        if rf, ok := ret.Get(0).(func(context.Context, model.DeviceID, string) error); ok {
1✔
489
                r0 = rf(ctx, id, text)
×
490
        } else {
1✔
491
                r0 = ret.Error(0)
1✔
492
        }
1✔
493

494
        return r0
1✔
495
}
496

497
// UpdateDevicesGroup provides a mock function with given fields: ctx, devIDs, group
498
func (_m *DataStore) UpdateDevicesGroup(ctx context.Context, devIDs []model.DeviceID, group model.GroupName) (*model.UpdateResult, error) {
1✔
499
        ret := _m.Called(ctx, devIDs, group)
1✔
500

1✔
501
        if len(ret) == 0 {
1✔
NEW
502
                panic("no return value specified for UpdateDevicesGroup")
×
503
        }
504

505
        var r0 *model.UpdateResult
1✔
506
        var r1 error
1✔
507
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID, model.GroupName) (*model.UpdateResult, error)); ok {
1✔
NEW
508
                return rf(ctx, devIDs, group)
×
NEW
509
        }
×
510
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID, model.GroupName) *model.UpdateResult); ok {
1✔
511
                r0 = rf(ctx, devIDs, group)
×
512
        } else {
1✔
513
                if ret.Get(0) != nil {
2✔
514
                        r0 = ret.Get(0).(*model.UpdateResult)
1✔
515
                }
1✔
516
        }
517

518
        if rf, ok := ret.Get(1).(func(context.Context, []model.DeviceID, model.GroupName) error); ok {
1✔
UNCOV
519
                r1 = rf(ctx, devIDs, group)
×
520
        } else {
1✔
521
                r1 = ret.Error(1)
1✔
522
        }
1✔
523

524
        return r0, r1
1✔
525
}
526

527
// UpsertDevicesAttributes provides a mock function with given fields: ctx, ids, attrs
528
func (_m *DataStore) UpsertDevicesAttributes(ctx context.Context, ids []model.DeviceID, attrs model.DeviceAttributes) (*model.UpdateResult, error) {
1✔
529
        ret := _m.Called(ctx, ids, attrs)
1✔
530

1✔
531
        if len(ret) == 0 {
1✔
NEW
532
                panic("no return value specified for UpsertDevicesAttributes")
×
533
        }
534

535
        var r0 *model.UpdateResult
1✔
536
        var r1 error
1✔
537
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID, model.DeviceAttributes) (*model.UpdateResult, error)); ok {
1✔
NEW
538
                return rf(ctx, ids, attrs)
×
NEW
539
        }
×
540
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID, model.DeviceAttributes) *model.UpdateResult); ok {
1✔
541
                r0 = rf(ctx, ids, attrs)
×
542
        } else {
1✔
543
                if ret.Get(0) != nil {
2✔
544
                        r0 = ret.Get(0).(*model.UpdateResult)
1✔
545
                }
1✔
546
        }
547

548
        if rf, ok := ret.Get(1).(func(context.Context, []model.DeviceID, model.DeviceAttributes) error); ok {
1✔
UNCOV
549
                r1 = rf(ctx, ids, attrs)
×
550
        } else {
1✔
551
                r1 = ret.Error(1)
1✔
552
        }
1✔
553

554
        return r0, r1
1✔
555
}
556

557
// UpsertDevicesAttributesWithRevision provides a mock function with given fields: ctx, ids, attrs
558
func (_m *DataStore) UpsertDevicesAttributesWithRevision(ctx context.Context, ids []model.DeviceUpdate, attrs model.DeviceAttributes) (*model.UpdateResult, error) {
1✔
559
        ret := _m.Called(ctx, ids, attrs)
1✔
560

1✔
561
        if len(ret) == 0 {
1✔
NEW
562
                panic("no return value specified for UpsertDevicesAttributesWithRevision")
×
563
        }
564

565
        var r0 *model.UpdateResult
1✔
566
        var r1 error
1✔
567
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceUpdate, model.DeviceAttributes) (*model.UpdateResult, error)); ok {
1✔
NEW
568
                return rf(ctx, ids, attrs)
×
NEW
569
        }
×
570
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceUpdate, model.DeviceAttributes) *model.UpdateResult); ok {
1✔
571
                r0 = rf(ctx, ids, attrs)
×
572
        } else {
1✔
573
                if ret.Get(0) != nil {
2✔
574
                        r0 = ret.Get(0).(*model.UpdateResult)
1✔
575
                }
1✔
576
        }
577

578
        if rf, ok := ret.Get(1).(func(context.Context, []model.DeviceUpdate, model.DeviceAttributes) error); ok {
1✔
UNCOV
579
                r1 = rf(ctx, ids, attrs)
×
580
        } else {
1✔
581
                r1 = ret.Error(1)
1✔
582
        }
1✔
583

584
        return r0, r1
1✔
585
}
586

587
// UpsertDevicesAttributesWithUpdated provides a mock function with given fields: ctx, ids, attrs, scope, etag
588
func (_m *DataStore) UpsertDevicesAttributesWithUpdated(ctx context.Context, ids []model.DeviceID, attrs model.DeviceAttributes, scope string, etag string) (*model.UpdateResult, error) {
1✔
589
        ret := _m.Called(ctx, ids, attrs, scope, etag)
1✔
590

1✔
591
        if len(ret) == 0 {
1✔
NEW
592
                panic("no return value specified for UpsertDevicesAttributesWithUpdated")
×
593
        }
594

595
        var r0 *model.UpdateResult
1✔
596
        var r1 error
1✔
597
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID, model.DeviceAttributes, string, string) (*model.UpdateResult, error)); ok {
1✔
NEW
598
                return rf(ctx, ids, attrs, scope, etag)
×
NEW
599
        }
×
600
        if rf, ok := ret.Get(0).(func(context.Context, []model.DeviceID, model.DeviceAttributes, string, string) *model.UpdateResult); ok {
1✔
601
                r0 = rf(ctx, ids, attrs, scope, etag)
×
602
        } else {
1✔
603
                if ret.Get(0) != nil {
2✔
604
                        r0 = ret.Get(0).(*model.UpdateResult)
1✔
605
                }
1✔
606
        }
607

608
        if rf, ok := ret.Get(1).(func(context.Context, []model.DeviceID, model.DeviceAttributes, string, string) error); ok {
1✔
UNCOV
609
                r1 = rf(ctx, ids, attrs, scope, etag)
×
610
        } else {
1✔
611
                r1 = ret.Error(1)
1✔
612
        }
1✔
613

614
        return r0, r1
1✔
615
}
616

617
// UpsertRemoveDeviceAttributes provides a mock function with given fields: ctx, id, updateAttrs, removeAttrs, scope, etag
618
func (_m *DataStore) UpsertRemoveDeviceAttributes(ctx context.Context, id model.DeviceID, updateAttrs model.DeviceAttributes, removeAttrs model.DeviceAttributes, scope string, etag string) (*model.UpdateResult, error) {
1✔
619
        ret := _m.Called(ctx, id, updateAttrs, removeAttrs, scope, etag)
1✔
620

1✔
621
        if len(ret) == 0 {
1✔
NEW
622
                panic("no return value specified for UpsertRemoveDeviceAttributes")
×
623
        }
624

625
        var r0 *model.UpdateResult
1✔
626
        var r1 error
1✔
627
        if rf, ok := ret.Get(0).(func(context.Context, model.DeviceID, model.DeviceAttributes, model.DeviceAttributes, string, string) (*model.UpdateResult, error)); ok {
1✔
NEW
628
                return rf(ctx, id, updateAttrs, removeAttrs, scope, etag)
×
NEW
629
        }
×
630
        if rf, ok := ret.Get(0).(func(context.Context, model.DeviceID, model.DeviceAttributes, model.DeviceAttributes, string, string) *model.UpdateResult); ok {
1✔
631
                r0 = rf(ctx, id, updateAttrs, removeAttrs, scope, etag)
×
632
        } else {
1✔
633
                if ret.Get(0) != nil {
2✔
634
                        r0 = ret.Get(0).(*model.UpdateResult)
1✔
635
                }
1✔
636
        }
637

638
        if rf, ok := ret.Get(1).(func(context.Context, model.DeviceID, model.DeviceAttributes, model.DeviceAttributes, string, string) error); ok {
1✔
UNCOV
639
                r1 = rf(ctx, id, updateAttrs, removeAttrs, scope, etag)
×
640
        } else {
1✔
641
                r1 = ret.Error(1)
1✔
642
        }
1✔
643

644
        return r0, r1
1✔
645
}
646

647
// WithAutomigrate provides a mock function with given fields:
648
func (_m *DataStore) WithAutomigrate() store.DataStore {
1✔
649
        ret := _m.Called()
1✔
650

1✔
651
        if len(ret) == 0 {
1✔
NEW
652
                panic("no return value specified for WithAutomigrate")
×
653
        }
654

655
        var r0 store.DataStore
1✔
656
        if rf, ok := ret.Get(0).(func() store.DataStore); ok {
1✔
657
                r0 = rf()
×
658
        } else {
1✔
659
                if ret.Get(0) != nil {
2✔
660
                        r0 = ret.Get(0).(store.DataStore)
1✔
661
                }
1✔
662
        }
663

664
        return r0
1✔
665
}
666

667
// 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.
668
// The first argument is typically a *testing.T value.
669
func NewDataStore(t interface {
670
        mock.TestingT
671
        Cleanup(func())
NEW
672
}) *DataStore {
×
NEW
673
        mock := &DataStore{}
×
NEW
674
        mock.Mock.Test(t)
×
NEW
675

×
NEW
676
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
677

NEW
678
        return mock
×
679
}
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