-
Notifications
You must be signed in to change notification settings - Fork 928
/
fake_service_key_repo.go
44 lines (33 loc) · 1.01 KB
/
fake_service_key_repo.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
package fakes
import (
"github.com/cloudfoundry/cli/cf/models"
)
type FakeServiceKeyRepo struct {
CreateServiceKeyMethod CreateServiceKeyType
ListServiceKeysMethod ListServiceKeysType
}
type CreateServiceKeyType struct {
InstanceId string
KeyName string
Error error
}
type ListServiceKeysType struct {
InstanceId string
ServiceKeys []models.ServiceKey
Error error
}
func NewFakeServiceKeyRepo() *FakeServiceKeyRepo {
return &FakeServiceKeyRepo{
CreateServiceKeyMethod: CreateServiceKeyType{},
ListServiceKeysMethod: ListServiceKeysType{},
}
}
func (f *FakeServiceKeyRepo) CreateServiceKey(instanceId string, serviceKeyName string) error {
f.CreateServiceKeyMethod.InstanceId = instanceId
f.CreateServiceKeyMethod.KeyName = serviceKeyName
return f.CreateServiceKeyMethod.Error
}
func (f *FakeServiceKeyRepo) ListServiceKeys(instanceId string) ([]models.ServiceKey, error) {
f.ListServiceKeysMethod.InstanceId = instanceId
return f.ListServiceKeysMethod.ServiceKeys, f.ListServiceKeysMethod.Error
}