• 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

77.78
/backend/services/deviceconfig/app/mocks/App.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

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

31
// DecommissionDevice provides a mock function with given fields: ctx, devID
32
func (_m *App) DecommissionDevice(ctx context.Context, devID string) error {
1✔
33
        ret := _m.Called(ctx, devID)
1✔
34

1✔
35
        if len(ret) == 0 {
1✔
NEW
36
                panic("no return value specified for DecommissionDevice")
×
37
        }
38

39
        var r0 error
1✔
40
        if rf, ok := ret.Get(0).(func(context.Context, string) error); ok {
1✔
41
                r0 = rf(ctx, devID)
×
42
        } else {
1✔
43
                r0 = ret.Error(0)
1✔
44
        }
1✔
45

46
        return r0
1✔
47
}
48

49
// DeleteTenant provides a mock function with given fields: ctx, tenant_id
50
func (_m *App) DeleteTenant(ctx context.Context, tenant_id string) error {
1✔
51
        ret := _m.Called(ctx, tenant_id)
1✔
52

1✔
53
        if len(ret) == 0 {
1✔
NEW
54
                panic("no return value specified for DeleteTenant")
×
55
        }
56

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

64
        return r0
1✔
65
}
66

67
// DeployConfiguration provides a mock function with given fields: ctx, device, request
68
func (_m *App) DeployConfiguration(ctx context.Context, device model.Device, request model.DeployConfigurationRequest) (model.DeployConfigurationResponse, error) {
1✔
69
        ret := _m.Called(ctx, device, request)
1✔
70

1✔
71
        if len(ret) == 0 {
1✔
NEW
72
                panic("no return value specified for DeployConfiguration")
×
73
        }
74

75
        var r0 model.DeployConfigurationResponse
1✔
76
        var r1 error
1✔
77
        if rf, ok := ret.Get(0).(func(context.Context, model.Device, model.DeployConfigurationRequest) (model.DeployConfigurationResponse, error)); ok {
1✔
NEW
78
                return rf(ctx, device, request)
×
NEW
79
        }
×
80
        if rf, ok := ret.Get(0).(func(context.Context, model.Device, model.DeployConfigurationRequest) model.DeployConfigurationResponse); ok {
1✔
81
                r0 = rf(ctx, device, request)
×
82
        } else {
1✔
83
                r0 = ret.Get(0).(model.DeployConfigurationResponse)
1✔
84
        }
1✔
85

86
        if rf, ok := ret.Get(1).(func(context.Context, model.Device, model.DeployConfigurationRequest) error); ok {
1✔
UNCOV
87
                r1 = rf(ctx, device, request)
×
88
        } else {
1✔
89
                r1 = ret.Error(1)
1✔
90
        }
1✔
91

92
        return r0, r1
1✔
93
}
94

95
// GetDevice provides a mock function with given fields: ctx, devID
96
func (_m *App) GetDevice(ctx context.Context, devID string) (model.Device, error) {
1✔
97
        ret := _m.Called(ctx, devID)
1✔
98

1✔
99
        if len(ret) == 0 {
1✔
NEW
100
                panic("no return value specified for GetDevice")
×
101
        }
102

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

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

120
        return r0, r1
1✔
121
}
122

123
// HealthCheck provides a mock function with given fields: ctx
124
func (_m *App) HealthCheck(ctx context.Context) error {
1✔
125
        ret := _m.Called(ctx)
1✔
126

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

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

138
        return r0
1✔
139
}
140

141
// ProvisionDevice provides a mock function with given fields: ctx, dev
142
func (_m *App) ProvisionDevice(ctx context.Context, dev model.NewDevice) error {
1✔
143
        ret := _m.Called(ctx, dev)
1✔
144

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

149
        var r0 error
1✔
150
        if rf, ok := ret.Get(0).(func(context.Context, model.NewDevice) error); ok {
1✔
151
                r0 = rf(ctx, dev)
×
152
        } else {
1✔
153
                r0 = ret.Error(0)
1✔
154
        }
1✔
155

156
        return r0
1✔
157
}
158

159
// ProvisionTenant provides a mock function with given fields: ctx, tenant
160
func (_m *App) ProvisionTenant(ctx context.Context, tenant model.NewTenant) error {
1✔
161
        ret := _m.Called(ctx, tenant)
1✔
162

1✔
163
        if len(ret) == 0 {
1✔
NEW
164
                panic("no return value specified for ProvisionTenant")
×
165
        }
166

167
        var r0 error
1✔
168
        if rf, ok := ret.Get(0).(func(context.Context, model.NewTenant) error); ok {
1✔
169
                r0 = rf(ctx, tenant)
×
170
        } else {
1✔
171
                r0 = ret.Error(0)
1✔
172
        }
1✔
173

174
        return r0
1✔
175
}
176

177
// SetConfiguration provides a mock function with given fields: ctx, devID, configuration
178
func (_m *App) SetConfiguration(ctx context.Context, devID string, configuration model.Attributes) error {
1✔
179
        ret := _m.Called(ctx, devID, configuration)
1✔
180

1✔
181
        if len(ret) == 0 {
1✔
NEW
182
                panic("no return value specified for SetConfiguration")
×
183
        }
184

185
        var r0 error
1✔
186
        if rf, ok := ret.Get(0).(func(context.Context, string, model.Attributes) error); ok {
1✔
187
                r0 = rf(ctx, devID, configuration)
×
188
        } else {
1✔
189
                r0 = ret.Error(0)
1✔
190
        }
1✔
191

192
        return r0
1✔
193
}
194

195
// SetReportedConfiguration provides a mock function with given fields: ctx, devID, configuration
196
func (_m *App) SetReportedConfiguration(ctx context.Context, devID string, configuration model.Attributes) error {
1✔
197
        ret := _m.Called(ctx, devID, configuration)
1✔
198

1✔
199
        if len(ret) == 0 {
1✔
NEW
200
                panic("no return value specified for SetReportedConfiguration")
×
201
        }
202

203
        var r0 error
1✔
204
        if rf, ok := ret.Get(0).(func(context.Context, string, model.Attributes) error); ok {
1✔
205
                r0 = rf(ctx, devID, configuration)
×
206
        } else {
1✔
207
                r0 = ret.Error(0)
1✔
208
        }
1✔
209

210
        return r0
1✔
211
}
212

213
// UpdateConfiguration provides a mock function with given fields: ctx, devID, attrs
214
func (_m *App) UpdateConfiguration(ctx context.Context, devID string, attrs model.Attributes) error {
1✔
215
        ret := _m.Called(ctx, devID, attrs)
1✔
216

1✔
217
        if len(ret) == 0 {
1✔
NEW
218
                panic("no return value specified for UpdateConfiguration")
×
219
        }
220

221
        var r0 error
1✔
222
        if rf, ok := ret.Get(0).(func(context.Context, string, model.Attributes) error); ok {
1✔
223
                r0 = rf(ctx, devID, attrs)
×
224
        } else {
1✔
225
                r0 = ret.Error(0)
1✔
226
        }
1✔
227

228
        return r0
1✔
229
}
230

231
// 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.
232
// The first argument is typically a *testing.T value.
233
func NewApp(t interface {
234
        mock.TestingT
235
        Cleanup(func())
NEW
236
}) *App {
×
NEW
237
        mock := &App{}
×
NEW
238
        mock.Mock.Test(t)
×
NEW
239

×
NEW
240
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
241

NEW
242
        return mock
×
243
}
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