This repository has been archived by the owner on Dec 12, 2023. It is now read-only.
/
docker_credential_operations_stub.go
95 lines (84 loc) · 4.31 KB
/
docker_credential_operations_stub.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
// Copyright © 2018 Bitgrip <berlin@bitgrip.de>
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
package stubs
import (
"testing"
"github.com/bitgrip/cattlectl/internal/pkg/assert"
"github.com/rancher/norman/types"
projectClient "github.com/rancher/types/client/project/v3"
)
// CreateDockerCredentialOperationsStub creates a stub of github.com/rancher/types/client/project/v3/DockerCredentialOperations
func CreateDockerCredentialOperationsStub(tb testing.TB) *DockerCredentialOperationsStub {
return &DockerCredentialOperationsStub{
tb: tb,
DoList: func(opts *types.ListOpts) (*projectClient.DockerCredentialCollection, error) {
assert.FailInStub(tb, 2, "Unexpected call of List")
return nil, nil
},
DoCreate: func(opts *projectClient.DockerCredential) (*projectClient.DockerCredential, error) {
assert.FailInStub(tb, 2, "Unexpected call of Create")
return nil, nil
},
DoUpdate: func(existing *projectClient.DockerCredential, updates interface{}) (*projectClient.DockerCredential, error) {
assert.FailInStub(tb, 2, "Unexpected call of Update")
return nil, nil
},
DoReplace: func(existing *projectClient.DockerCredential) (*projectClient.DockerCredential, error) {
assert.FailInStub(tb, 2, "Unexpected call of Replace")
return nil, nil
},
DoByID: func(id string) (*projectClient.DockerCredential, error) {
assert.FailInStub(tb, 2, "Unexpected call of ByID")
return nil, nil
},
DoDelete: func(container *projectClient.DockerCredential) error {
assert.FailInStub(tb, 2, "Unexpected call of Delete")
return nil
},
}
}
// DockerCredentialOperationsStub structure to hold callbacks used to stub github.com/rancher/types/client/project/v3/DockerCredentialOperations
type DockerCredentialOperationsStub struct {
tb testing.TB
DoList func(opts *types.ListOpts) (*projectClient.DockerCredentialCollection, error)
DoCreate func(opts *projectClient.DockerCredential) (*projectClient.DockerCredential, error)
DoUpdate func(existing *projectClient.DockerCredential, updates interface{}) (*projectClient.DockerCredential, error)
DoReplace func(existing *projectClient.DockerCredential) (*projectClient.DockerCredential, error)
DoByID func(id string) (*projectClient.DockerCredential, error)
DoDelete func(container *projectClient.DockerCredential) error
}
// List implements github.com/rancher/types/client/project/v3/DockerCredentialOperations.List(...)
func (stub DockerCredentialOperationsStub) List(opts *types.ListOpts) (*projectClient.DockerCredentialCollection, error) {
return stub.DoList(opts)
}
// Create implements github.com/rancher/types/client/project/v3/DockerCredentialOperations.Create(...)
func (stub DockerCredentialOperationsStub) Create(opts *projectClient.DockerCredential) (*projectClient.DockerCredential, error) {
return stub.DoCreate(opts)
}
// Update implements github.com/rancher/types/client/project/v3/DockerCredentialOperations.Update(...)
func (stub DockerCredentialOperationsStub) Update(existing *projectClient.DockerCredential, updates interface{}) (*projectClient.DockerCredential, error) {
return stub.DoUpdate(existing, updates)
}
// Replace implements github.com/rancher/types/client/project/v3/DockerCredentialOperations.Replace(...)
func (stub DockerCredentialOperationsStub) Replace(existing *projectClient.DockerCredential) (*projectClient.DockerCredential, error) {
return stub.DoReplace(existing)
}
// ByID implements github.com/rancher/types/client/project/v3/DockerCredentialOperations.ByID(...)
func (stub DockerCredentialOperationsStub) ByID(id string) (*projectClient.DockerCredential, error) {
return stub.DoByID(id)
}
// Delete implements github.com/rancher/types/client/project/v3/DockerCredentialOperations.Delete(...)
func (stub DockerCredentialOperationsStub) Delete(container *projectClient.DockerCredential) error {
return stub.DoDelete(container)
}