• 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.0
/backend/services/useradm/client/tenant/mocks/ClientRunner.go
1
// Copyright 2022 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
        apiclient "github.com/mendersoftware/mender-server/pkg/apiclient"
23

24
        mock "github.com/stretchr/testify/mock"
25

26
        tenant "github.com/mendersoftware/mender-server/services/useradm/client/tenant"
27
)
28

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

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

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

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

49
        return r0
1✔
50
}
51

52
// CreateUser provides a mock function with given fields: ctx, user, client
53
func (_m *ClientRunner) CreateUser(ctx context.Context, user *tenant.User, client apiclient.HttpRunner) error {
1✔
54
        ret := _m.Called(ctx, user, client)
1✔
55

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

60
        var r0 error
1✔
61
        if rf, ok := ret.Get(0).(func(context.Context, *tenant.User, apiclient.HttpRunner) error); ok {
1✔
62
                r0 = rf(ctx, user, client)
×
63
        } else {
1✔
64
                r0 = ret.Error(0)
1✔
65
        }
1✔
66

67
        return r0
1✔
68
}
69

70
// DeleteUser provides a mock function with given fields: ctx, tenantId, clientId, client
71
func (_m *ClientRunner) DeleteUser(ctx context.Context, tenantId string, clientId string, client apiclient.HttpRunner) error {
1✔
72
        ret := _m.Called(ctx, tenantId, clientId, client)
1✔
73

1✔
74
        if len(ret) == 0 {
1✔
NEW
75
                panic("no return value specified for DeleteUser")
×
76
        }
77

78
        var r0 error
1✔
79
        if rf, ok := ret.Get(0).(func(context.Context, string, string, apiclient.HttpRunner) error); ok {
1✔
80
                r0 = rf(ctx, tenantId, clientId, client)
×
81
        } else {
1✔
82
                r0 = ret.Error(0)
1✔
83
        }
1✔
84

85
        return r0
1✔
86
}
87

88
// GetTenant provides a mock function with given fields: ctx, username, client
89
func (_m *ClientRunner) GetTenant(ctx context.Context, username string, client apiclient.HttpRunner) (*tenant.Tenant, error) {
1✔
90
        ret := _m.Called(ctx, username, client)
1✔
91

1✔
92
        if len(ret) == 0 {
1✔
NEW
93
                panic("no return value specified for GetTenant")
×
94
        }
95

96
        var r0 *tenant.Tenant
1✔
97
        var r1 error
1✔
98
        if rf, ok := ret.Get(0).(func(context.Context, string, apiclient.HttpRunner) (*tenant.Tenant, error)); ok {
1✔
NEW
99
                return rf(ctx, username, client)
×
NEW
100
        }
×
101
        if rf, ok := ret.Get(0).(func(context.Context, string, apiclient.HttpRunner) *tenant.Tenant); ok {
1✔
102
                r0 = rf(ctx, username, client)
×
103
        } else {
1✔
104
                if ret.Get(0) != nil {
2✔
105
                        r0 = ret.Get(0).(*tenant.Tenant)
1✔
106
                }
1✔
107
        }
108

109
        if rf, ok := ret.Get(1).(func(context.Context, string, apiclient.HttpRunner) error); ok {
1✔
UNCOV
110
                r1 = rf(ctx, username, client)
×
111
        } else {
1✔
112
                r1 = ret.Error(1)
1✔
113
        }
1✔
114

115
        return r0, r1
1✔
116
}
117

118
// UpdateUser provides a mock function with given fields: ctx, tenantId, userId, u, client
119
func (_m *ClientRunner) UpdateUser(ctx context.Context, tenantId string, userId string, u *tenant.UserUpdate, client apiclient.HttpRunner) error {
1✔
120
        ret := _m.Called(ctx, tenantId, userId, u, client)
1✔
121

1✔
122
        if len(ret) == 0 {
1✔
NEW
123
                panic("no return value specified for UpdateUser")
×
124
        }
125

126
        var r0 error
1✔
127
        if rf, ok := ret.Get(0).(func(context.Context, string, string, *tenant.UserUpdate, apiclient.HttpRunner) error); ok {
1✔
128
                r0 = rf(ctx, tenantId, userId, u, client)
×
129
        } else {
1✔
130
                r0 = ret.Error(0)
1✔
131
        }
1✔
132

133
        return r0
1✔
134
}
135

136
// NewClientRunner creates a new instance of ClientRunner. It also registers a testing interface on the mock and a cleanup function to assert the mocks expectations.
137
// The first argument is typically a *testing.T value.
138
func NewClientRunner(t interface {
139
        mock.TestingT
140
        Cleanup(func())
NEW
141
}) *ClientRunner {
×
NEW
142
        mock := &ClientRunner{}
×
NEW
143
        mock.Mock.Test(t)
×
NEW
144

×
NEW
145
        t.Cleanup(func() { mock.AssertExpectations(t) })
×
146

NEW
147
        return mock
×
148
}
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