forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_routes.go
45 lines (36 loc) · 1.49 KB
/
fake_routes.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
package client
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
"github.com/GoogleCloudPlatform/kubernetes/pkg/watch"
routeapi "github.com/openshift/origin/pkg/route/api"
)
// FakeRoutes 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 FakeRoutes struct {
Fake *Fake
Namespace string
}
func (c *FakeRoutes) List(label, field labels.Selector) (*routeapi.RouteList, error) {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "list-routes"})
return &routeapi.RouteList{}, nil
}
func (c *FakeRoutes) Get(name string) (*routeapi.Route, error) {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "get-route"})
return &routeapi.Route{}, nil
}
func (c *FakeRoutes) Create(route *routeapi.Route) (*routeapi.Route, error) {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "create-route"})
return &routeapi.Route{}, nil
}
func (c *FakeRoutes) Update(route *routeapi.Route) (*routeapi.Route, error) {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "update-route"})
return &routeapi.Route{}, nil
}
func (c *FakeRoutes) Delete(name string) error {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "delete-route"})
return nil
}
func (c *FakeRoutes) Watch(label, field labels.Selector, resourceVersion string) (watch.Interface, error) {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "watch-routes"})
return nil, nil
}