• 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

73.58
/backend/services/iot-manager/client/iotcore/mocks/Client.go
1
// Copyright 2024 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
        iotcore "github.com/mendersoftware/mender-server/services/iot-manager/client/iotcore"
23
        mock "github.com/stretchr/testify/mock"
24

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

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

33
// DeleteDevice provides a mock function with given fields: ctx, creds, deviceID
34
func (_m *Client) DeleteDevice(ctx context.Context, creds model.AWSCredentials, deviceID string) error {
1✔
35
        ret := _m.Called(ctx, creds, deviceID)
1✔
36

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

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

48
        return r0
1✔
49
}
50

51
// GetDevice provides a mock function with given fields: ctx, creds, deviceID
52
func (_m *Client) GetDevice(ctx context.Context, creds model.AWSCredentials, deviceID string) (*iotcore.Device, error) {
1✔
53
        ret := _m.Called(ctx, creds, deviceID)
1✔
54

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

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

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

78
        return r0, r1
1✔
79
}
80

81
// GetDeviceShadow provides a mock function with given fields: ctx, creds, id
82
func (_m *Client) GetDeviceShadow(ctx context.Context, creds model.AWSCredentials, id string) (*iotcore.DeviceShadow, error) {
1✔
83
        ret := _m.Called(ctx, creds, id)
1✔
84

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

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

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

108
        return r0, r1
1✔
109
}
110

111
// UpdateDeviceShadow provides a mock function with given fields: ctx, creds, deviceID, update
112
func (_m *Client) UpdateDeviceShadow(ctx context.Context, creds model.AWSCredentials, deviceID string, update iotcore.DeviceShadowUpdate) (*iotcore.DeviceShadow, error) {
1✔
113
        ret := _m.Called(ctx, creds, deviceID, update)
1✔
114

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

119
        var r0 *iotcore.DeviceShadow
1✔
120
        var r1 error
1✔
121
        if rf, ok := ret.Get(0).(func(context.Context, model.AWSCredentials, string, iotcore.DeviceShadowUpdate) (*iotcore.DeviceShadow, error)); ok {
1✔
NEW
122
                return rf(ctx, creds, deviceID, update)
×
NEW
123
        }
×
124
        if rf, ok := ret.Get(0).(func(context.Context, model.AWSCredentials, string, iotcore.DeviceShadowUpdate) *iotcore.DeviceShadow); ok {
1✔
125
                r0 = rf(ctx, creds, deviceID, update)
×
126
        } else {
1✔
127
                if ret.Get(0) != nil {
2✔
128
                        r0 = ret.Get(0).(*iotcore.DeviceShadow)
1✔
129
                }
1✔
130
        }
131

132
        if rf, ok := ret.Get(1).(func(context.Context, model.AWSCredentials, string, iotcore.DeviceShadowUpdate) error); ok {
1✔
UNCOV
133
                r1 = rf(ctx, creds, deviceID, update)
×
134
        } else {
1✔
135
                r1 = ret.Error(1)
1✔
136
        }
1✔
137

138
        return r0, r1
1✔
139
}
140

141
// UpsertDevice provides a mock function with given fields: ctx, creds, deviceID, device, policy
142
func (_m *Client) UpsertDevice(ctx context.Context, creds model.AWSCredentials, deviceID string, device *iotcore.Device, policy string) (*iotcore.Device, error) {
1✔
143
        ret := _m.Called(ctx, creds, deviceID, device, policy)
1✔
144

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

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

162
        if rf, ok := ret.Get(1).(func(context.Context, model.AWSCredentials, string, *iotcore.Device, string) error); ok {
1✔
UNCOV
163
                r1 = rf(ctx, creds, deviceID, device, policy)
×
164
        } else {
1✔
165
                r1 = ret.Error(1)
1✔
166
        }
1✔
167

168
        return r0, r1
1✔
169
}
170

171
// NewClient creates a new instance of Client. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
172
// The first argument is typically a *testing.T value.
173
func NewClient(t interface {
174
        mock.TestingT
175
        Cleanup(func())
NEW
176
}) *Client {
×
NEW
177
        mock := &Client{}
×
NEW
178
        mock.Mock.Test(t)
×
NEW
179

×
NEW
180
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
181

NEW
182
        return mock
×
183
}
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