• 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

72.06
/backend/services/deployments/client/inventory/mocks/Client.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
        mock "github.com/stretchr/testify/mock"
23

24
        model "github.com/mendersoftware/mender-server/services/deployments/model"
25
)
26

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

32
// CheckHealth provides a mock function with given fields: ctx
33
func (_m *Client) CheckHealth(ctx context.Context) error {
1✔
34
        ret := _m.Called(ctx)
1✔
35

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

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

47
        return r0
1✔
48
}
49

50
// GetDeviceGroups provides a mock function with given fields: ctx, tenantId, deviceId
51
func (_m *Client) GetDeviceGroups(ctx context.Context, tenantId string, deviceId string) ([]string, error) {
1✔
52
        ret := _m.Called(ctx, tenantId, deviceId)
1✔
53

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

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

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

77
        return r0, r1
1✔
78
}
79

80
// Search provides a mock function with given fields: ctx, tenantId, searchParams
81
func (_m *Client) Search(ctx context.Context, tenantId string, searchParams model.SearchParams) ([]model.InvDevice, int, error) {
1✔
82
        ret := _m.Called(ctx, tenantId, searchParams)
1✔
83

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

88
        var r0 []model.InvDevice
1✔
89
        var r1 int
1✔
90
        var r2 error
1✔
91
        if rf, ok := ret.Get(0).(func(context.Context, string, model.SearchParams) ([]model.InvDevice, int, error)); ok {
1✔
NEW
92
                return rf(ctx, tenantId, searchParams)
×
NEW
93
        }
×
94
        if rf, ok := ret.Get(0).(func(context.Context, string, model.SearchParams) []model.InvDevice); ok {
1✔
95
                r0 = rf(ctx, tenantId, searchParams)
×
96
        } else {
1✔
97
                if ret.Get(0) != nil {
2✔
98
                        r0 = ret.Get(0).([]model.InvDevice)
1✔
99
                }
1✔
100
        }
101

102
        if rf, ok := ret.Get(1).(func(context.Context, string, model.SearchParams) int); ok {
1✔
UNCOV
103
                r1 = rf(ctx, tenantId, searchParams)
×
104
        } else {
1✔
105
                r1 = ret.Get(1).(int)
1✔
106
        }
1✔
107

108
        if rf, ok := ret.Get(2).(func(context.Context, string, model.SearchParams) error); ok {
1✔
UNCOV
109
                r2 = rf(ctx, tenantId, searchParams)
×
110
        } else {
1✔
111
                r2 = ret.Error(2)
1✔
112
        }
1✔
113

114
        return r0, r1, r2
1✔
115
}
116

117
// 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.
118
// The first argument is typically a *testing.T value.
119
func NewClient(t interface {
120
        mock.TestingT
121
        Cleanup(func())
NEW
122
}) *Client {
×
UNCOV
123
        mock := &Client{}
×
124
        mock.Mock.Test(t)
×
125

×
126
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
127

128
        return mock
×
129
}
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