forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_builds.go
84 lines (66 loc) · 2.48 KB
/
fake_builds.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
package testclient
import (
kapi "k8s.io/kubernetes/pkg/api"
"k8s.io/kubernetes/pkg/api/unversioned"
"k8s.io/kubernetes/pkg/client/testing/core"
"k8s.io/kubernetes/pkg/watch"
buildapi "github.com/openshift/origin/pkg/build/api"
)
// FakeBuilds implements BuildInterface. Meant to be embedded into a struct to get a default
// implementation. This makes faking out just the methods you want to test easier.
type FakeBuilds struct {
Fake *Fake
Namespace string
}
var buildsResource = unversioned.GroupVersionResource{Group: "", Version: "", Resource: "builds"}
func (c *FakeBuilds) Get(name string) (*buildapi.Build, error) {
obj, err := c.Fake.Invokes(core.NewGetAction(buildsResource, c.Namespace, name), &buildapi.Build{})
if obj == nil {
return nil, err
}
return obj.(*buildapi.Build), err
}
func (c *FakeBuilds) List(opts kapi.ListOptions) (*buildapi.BuildList, error) {
obj, err := c.Fake.Invokes(core.NewListAction(buildsResource, c.Namespace, opts), &buildapi.BuildList{})
if obj == nil {
return nil, err
}
return obj.(*buildapi.BuildList), err
}
func (c *FakeBuilds) Create(inObj *buildapi.Build) (*buildapi.Build, error) {
obj, err := c.Fake.Invokes(core.NewCreateAction(buildsResource, c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*buildapi.Build), err
}
func (c *FakeBuilds) Update(inObj *buildapi.Build) (*buildapi.Build, error) {
obj, err := c.Fake.Invokes(core.NewUpdateAction(buildsResource, c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*buildapi.Build), err
}
func (c *FakeBuilds) Delete(name string) error {
_, err := c.Fake.Invokes(core.NewDeleteAction(buildsResource, c.Namespace, name), &buildapi.Build{})
return err
}
func (c *FakeBuilds) Watch(opts kapi.ListOptions) (watch.Interface, error) {
return c.Fake.InvokesWatch(core.NewWatchAction(buildsResource, c.Namespace, opts))
}
func (c *FakeBuilds) Clone(request *buildapi.BuildRequest) (result *buildapi.Build, err error) {
action := core.NewCreateAction(buildsResource, c.Namespace, request)
action.Subresource = "clone"
obj, err := c.Fake.Invokes(action, &buildapi.Build{})
if obj == nil {
return nil, err
}
return obj.(*buildapi.Build), err
}
func (c *FakeBuilds) UpdateDetails(inObj *buildapi.Build) (*buildapi.Build, error) {
obj, err := c.Fake.Invokes(core.NewUpdateAction(buildapi.SchemeGroupVersion.WithResource("builds/details"), c.Namespace, inObj), inObj)
if obj == nil {
return nil, err
}
return obj.(*buildapi.Build), err
}