forked from openshift/origin
/
fake_imagestreamtags.go
34 lines (26 loc) · 1.01 KB
/
fake_imagestreamtags.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 testclient
import (
"fmt"
"github.com/openshift/origin/pkg/client"
imageapi "github.com/openshift/origin/pkg/image/api"
)
// FakeImageStreamTags implements ImageStreamTagInterface. 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 FakeImageStreamTags struct {
Fake *Fake
Namespace string
}
var _ client.ImageStreamTagInterface = &FakeImageStreamTags{}
func (c *FakeImageStreamTags) Get(name, tag string) (result *imageapi.ImageStreamTag, err error) {
c.Fake.Lock.Lock()
defer c.Fake.Lock.Unlock()
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "get-imagestream-tag", Value: fmt.Sprintf("%s:%s", name, tag)})
return &imageapi.ImageStreamTag{}, nil
}
func (c *FakeImageStreamTags) Delete(name, tag string) error {
c.Fake.Lock.Lock()
defer c.Fake.Lock.Unlock()
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "delete-imagestream-tag", Value: fmt.Sprintf("%s:%s", name, tag)})
return nil
}