forked from openshift/origin
-
Notifications
You must be signed in to change notification settings - Fork 0
/
fake_roles.go
39 lines (31 loc) · 1.46 KB
/
fake_roles.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
package testclient
import (
"github.com/GoogleCloudPlatform/kubernetes/pkg/fields"
"github.com/GoogleCloudPlatform/kubernetes/pkg/labels"
authorizationapi "github.com/openshift/origin/pkg/authorization/api"
)
// FakeRoles implements RoleInterface. 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 FakeRoles struct {
Fake *Fake
}
func (c *FakeRoles) List(label labels.Selector, field fields.Selector) (*authorizationapi.RoleList, error) {
obj, err := c.Fake.Invokes(FakeAction{Action: "list-role"}, &authorizationapi.RoleList{})
return obj.(*authorizationapi.RoleList), err
}
func (c *FakeRoles) Get(name string) (*authorizationapi.Role, error) {
obj, err := c.Fake.Invokes(FakeAction{Action: "get-role"}, &authorizationapi.Role{})
return obj.(*authorizationapi.Role), err
}
func (c *FakeRoles) Create(role *authorizationapi.Role) (*authorizationapi.Role, error) {
obj, err := c.Fake.Invokes(FakeAction{Action: "create-role", Value: role}, &authorizationapi.Role{})
return obj.(*authorizationapi.Role), err
}
func (c *FakeRoles) Update(role *authorizationapi.Role) (*authorizationapi.Role, error) {
obj, err := c.Fake.Invokes(FakeAction{Action: "update-role"}, &authorizationapi.Role{})
return obj.(*authorizationapi.Role), err
}
func (c *FakeRoles) Delete(name string) error {
c.Fake.Actions = append(c.Fake.Actions, FakeAction{Action: "delete-role", Value: name})
return nil
}