forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_images.go
34 lines (27 loc) · 1.08 KB
/
fake_images.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
package client
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
imageapi "github.com/openshift/origin/pkg/image/api"
)
// FakeImages implements ImageInterface. 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 FakeImages struct {
Fake *Fake
Namespace string
}
func (c *FakeImages) List(label, field labels.Selector) (*imageapi.ImageList, error) {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "list-images"})
return &imageapi.ImageList{}, nil
}
func (c *FakeImages) Get(name string) (*imageapi.Image, error) {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "get-image", Value: name})
return &imageapi.Image{}, nil
}
func (c *FakeImages) Create(image *imageapi.Image) (*imageapi.Image, error) {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "create-image"})
return &imageapi.Image{}, nil
}
func (c *FakeImages) Delete(name string) error {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "delete-image", Value: name})
return nil
}