• 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

75.31
/backend/services/reporting/app/reporting/mocks/App.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
        inventory "github.com/mendersoftware/mender-server/services/reporting/client/inventory"
23
        mock "github.com/stretchr/testify/mock"
24

25
        model "github.com/mendersoftware/mender-server/services/reporting/model"
26
)
27

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

33
// AggregateDeployments provides a mock function with given fields: ctx, aggregateParams
34
func (_m *App) AggregateDeployments(ctx context.Context, aggregateParams *model.AggregateDeploymentsParams) ([]model.DeviceAggregation, error) {
1✔
35
        ret := _m.Called(ctx, aggregateParams)
1✔
36

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

41
        var r0 []model.DeviceAggregation
1✔
42
        var r1 error
1✔
43
        if rf, ok := ret.Get(0).(func(context.Context, *model.AggregateDeploymentsParams) ([]model.DeviceAggregation, error)); ok {
1✔
NEW
44
                return rf(ctx, aggregateParams)
×
NEW
45
        }
×
46
        if rf, ok := ret.Get(0).(func(context.Context, *model.AggregateDeploymentsParams) []model.DeviceAggregation); ok {
1✔
47
                r0 = rf(ctx, aggregateParams)
×
48
        } else {
1✔
49
                if ret.Get(0) != nil {
2✔
50
                        r0 = ret.Get(0).([]model.DeviceAggregation)
1✔
51
                }
1✔
52
        }
53

54
        if rf, ok := ret.Get(1).(func(context.Context, *model.AggregateDeploymentsParams) error); ok {
1✔
UNCOV
55
                r1 = rf(ctx, aggregateParams)
×
56
        } else {
1✔
57
                r1 = ret.Error(1)
1✔
58
        }
1✔
59

60
        return r0, r1
1✔
61
}
62

63
// AggregateDevices provides a mock function with given fields: ctx, aggregateParams
64
func (_m *App) AggregateDevices(ctx context.Context, aggregateParams *model.AggregateParams) ([]model.DeviceAggregation, error) {
1✔
65
        ret := _m.Called(ctx, aggregateParams)
1✔
66

1✔
67
        if len(ret) == 0 {
1✔
NEW
68
                panic("no return value specified for AggregateDevices")
×
69
        }
70

71
        var r0 []model.DeviceAggregation
1✔
72
        var r1 error
1✔
73
        if rf, ok := ret.Get(0).(func(context.Context, *model.AggregateParams) ([]model.DeviceAggregation, error)); ok {
1✔
NEW
74
                return rf(ctx, aggregateParams)
×
NEW
75
        }
×
76
        if rf, ok := ret.Get(0).(func(context.Context, *model.AggregateParams) []model.DeviceAggregation); ok {
1✔
77
                r0 = rf(ctx, aggregateParams)
×
78
        } else {
1✔
79
                if ret.Get(0) != nil {
2✔
80
                        r0 = ret.Get(0).([]model.DeviceAggregation)
1✔
81
                }
1✔
82
        }
83

84
        if rf, ok := ret.Get(1).(func(context.Context, *model.AggregateParams) error); ok {
1✔
UNCOV
85
                r1 = rf(ctx, aggregateParams)
×
86
        } else {
1✔
87
                r1 = ret.Error(1)
1✔
88
        }
1✔
89

90
        return r0, r1
1✔
91
}
92

93
// GetMapping provides a mock function with given fields: ctx, tid
94
func (_m *App) GetMapping(ctx context.Context, tid string) (*model.Mapping, error) {
1✔
95
        ret := _m.Called(ctx, tid)
1✔
96

1✔
97
        if len(ret) == 0 {
1✔
NEW
98
                panic("no return value specified for GetMapping")
×
99
        }
100

101
        var r0 *model.Mapping
1✔
102
        var r1 error
1✔
103
        if rf, ok := ret.Get(0).(func(context.Context, string) (*model.Mapping, error)); ok {
1✔
NEW
104
                return rf(ctx, tid)
×
NEW
105
        }
×
106
        if rf, ok := ret.Get(0).(func(context.Context, string) *model.Mapping); ok {
1✔
107
                r0 = rf(ctx, tid)
×
108
        } else {
1✔
109
                if ret.Get(0) != nil {
2✔
110
                        r0 = ret.Get(0).(*model.Mapping)
1✔
111
                }
1✔
112
        }
113

114
        if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
1✔
UNCOV
115
                r1 = rf(ctx, tid)
×
116
        } else {
1✔
117
                r1 = ret.Error(1)
1✔
118
        }
1✔
119

120
        return r0, r1
1✔
121
}
122

123
// GetSearchableInvAttrs provides a mock function with given fields: ctx, tid
124
func (_m *App) GetSearchableInvAttrs(ctx context.Context, tid string) ([]model.FilterAttribute, error) {
1✔
125
        ret := _m.Called(ctx, tid)
1✔
126

1✔
127
        if len(ret) == 0 {
1✔
NEW
128
                panic("no return value specified for GetSearchableInvAttrs")
×
129
        }
130

131
        var r0 []model.FilterAttribute
1✔
132
        var r1 error
1✔
133
        if rf, ok := ret.Get(0).(func(context.Context, string) ([]model.FilterAttribute, error)); ok {
1✔
NEW
134
                return rf(ctx, tid)
×
NEW
135
        }
×
136
        if rf, ok := ret.Get(0).(func(context.Context, string) []model.FilterAttribute); ok {
1✔
137
                r0 = rf(ctx, tid)
×
138
        } else {
1✔
139
                if ret.Get(0) != nil {
2✔
140
                        r0 = ret.Get(0).([]model.FilterAttribute)
1✔
141
                }
1✔
142
        }
143

144
        if rf, ok := ret.Get(1).(func(context.Context, string) error); ok {
1✔
UNCOV
145
                r1 = rf(ctx, tid)
×
146
        } else {
1✔
147
                r1 = ret.Error(1)
1✔
148
        }
1✔
149

150
        return r0, r1
1✔
151
}
152

153
// HealthCheck provides a mock function with given fields: ctx
154
func (_m *App) HealthCheck(ctx context.Context) error {
1✔
155
        ret := _m.Called(ctx)
1✔
156

1✔
157
        if len(ret) == 0 {
1✔
NEW
158
                panic("no return value specified for HealthCheck")
×
159
        }
160

161
        var r0 error
1✔
162
        if rf, ok := ret.Get(0).(func(context.Context) error); ok {
1✔
163
                r0 = rf(ctx)
×
164
        } else {
1✔
165
                r0 = ret.Error(0)
1✔
166
        }
1✔
167

168
        return r0
1✔
169
}
170

171
// SearchDeployments provides a mock function with given fields: ctx, searchParams
172
func (_m *App) SearchDeployments(ctx context.Context, searchParams *model.DeploymentsSearchParams) ([]model.Deployment, int, error) {
1✔
173
        ret := _m.Called(ctx, searchParams)
1✔
174

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

179
        var r0 []model.Deployment
1✔
180
        var r1 int
1✔
181
        var r2 error
1✔
182
        if rf, ok := ret.Get(0).(func(context.Context, *model.DeploymentsSearchParams) ([]model.Deployment, int, error)); ok {
1✔
NEW
183
                return rf(ctx, searchParams)
×
NEW
184
        }
×
185
        if rf, ok := ret.Get(0).(func(context.Context, *model.DeploymentsSearchParams) []model.Deployment); ok {
1✔
186
                r0 = rf(ctx, searchParams)
×
187
        } else {
1✔
188
                if ret.Get(0) != nil {
2✔
189
                        r0 = ret.Get(0).([]model.Deployment)
1✔
190
                }
1✔
191
        }
192

193
        if rf, ok := ret.Get(1).(func(context.Context, *model.DeploymentsSearchParams) int); ok {
1✔
UNCOV
194
                r1 = rf(ctx, searchParams)
×
195
        } else {
1✔
196
                r1 = ret.Get(1).(int)
1✔
197
        }
1✔
198

199
        if rf, ok := ret.Get(2).(func(context.Context, *model.DeploymentsSearchParams) error); ok {
1✔
UNCOV
200
                r2 = rf(ctx, searchParams)
×
201
        } else {
1✔
202
                r2 = ret.Error(2)
1✔
203
        }
1✔
204

205
        return r0, r1, r2
1✔
206
}
207

208
// SearchDevices provides a mock function with given fields: ctx, searchParams
209
func (_m *App) SearchDevices(ctx context.Context, searchParams *model.SearchParams) ([]inventory.Device, int, error) {
1✔
210
        ret := _m.Called(ctx, searchParams)
1✔
211

1✔
212
        if len(ret) == 0 {
1✔
NEW
213
                panic("no return value specified for SearchDevices")
×
214
        }
215

216
        var r0 []inventory.Device
1✔
217
        var r1 int
1✔
218
        var r2 error
1✔
219
        if rf, ok := ret.Get(0).(func(context.Context, *model.SearchParams) ([]inventory.Device, int, error)); ok {
1✔
NEW
220
                return rf(ctx, searchParams)
×
NEW
221
        }
×
222
        if rf, ok := ret.Get(0).(func(context.Context, *model.SearchParams) []inventory.Device); ok {
1✔
223
                r0 = rf(ctx, searchParams)
×
224
        } else {
1✔
225
                if ret.Get(0) != nil {
2✔
226
                        r0 = ret.Get(0).([]inventory.Device)
1✔
227
                }
1✔
228
        }
229

230
        if rf, ok := ret.Get(1).(func(context.Context, *model.SearchParams) int); ok {
1✔
UNCOV
231
                r1 = rf(ctx, searchParams)
×
232
        } else {
1✔
233
                r1 = ret.Get(1).(int)
1✔
234
        }
1✔
235

236
        if rf, ok := ret.Get(2).(func(context.Context, *model.SearchParams) error); ok {
1✔
UNCOV
237
                r2 = rf(ctx, searchParams)
×
238
        } else {
1✔
239
                r2 = ret.Error(2)
1✔
240
        }
1✔
241

242
        return r0, r1, r2
1✔
243
}
244

245
// NewApp creates a new instance of App. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
246
// The first argument is typically a *testing.T value.
247
func NewApp(t interface {
248
        mock.TestingT
249
        Cleanup(func())
NEW
250
}) *App {
×
NEW
251
        mock := &App{}
×
NEW
252
        mock.Mock.Test(t)
×
NEW
253

×
NEW
254
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
255

NEW
256
        return mock
×
257
}
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