Documentation
¶
Index ¶
- func CreateMockResponseBody(fileName string) io.ReadCloser
- func LoadMockJSON(fileName string) []byte
- func LoadMockStruct(fileName string, v interface{})
- func ReadFile(fileName string) string
- type MockClient
- func (m *MockClient) CreateAccount(ctx context.Context, username string, password string) (*client.Account, annotations.Annotations, error)
- func (m *MockClient) GetAccounts(ctx context.Context) ([]*client.Account, error)
- func (m *MockClient) GetDefaultRole(ctx context.Context) (string, error)
- func (m *MockClient) GetGroups(ctx context.Context) ([]*client.Group, error)
- func (m *MockClient) GetRBACConfigMap(ctx context.Context) (*corev1.ConfigMap, error)
- func (m *MockClient) GetRoleSubjects(ctx context.Context, roleID string) ([]string, error)
- func (m *MockClient) GetRoleUsers(ctx context.Context, roleID string) ([]*client.Account, error)
- func (m *MockClient) GetRoles(ctx context.Context) ([]*client.Role, annotations.Annotations, error)
- func (m *MockClient) GetSubjectsForAllRoles(ctx context.Context) (map[string][]string, error)
- func (m *MockClient) GetUserRoles(ctx context.Context, userID string) ([]string, error)
- func (m *MockClient) RemoveUserRole(ctx context.Context, userID string, roleID string) (annotations.Annotations, error)
- func (m *MockClient) UpdateUserRole(ctx context.Context, userID string, roleID string) (annotations.Annotations, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateMockResponseBody ¶
func CreateMockResponseBody(fileName string) io.ReadCloser
CreateMockResponseBody creates an io.ReadCloser with the contents of the file.
func LoadMockJSON ¶
LoadMockJSON loads the content of a mock JSON file from /test/mock/ as []byte.
func LoadMockStruct ¶
func LoadMockStruct(fileName string, v interface{})
LoadMockStruct loads a mock JSON file and unmarshals it into the provided interface.
Types ¶
type MockClient ¶
type MockClient struct {
GetAccountsFunc func(ctx context.Context) ([]*client.Account, error)
GetRolesFunc func(ctx context.Context) ([]*client.Role, annotations.Annotations, error)
GetGroupsFunc func(ctx context.Context) ([]*client.Group, error)
GetDefaultRoleFunc func(ctx context.Context) (string, error)
CreateAccountFunc func(ctx context.Context, username string, password string) (*client.Account, annotations.Annotations, error)
UpdateUserRoleFunc func(ctx context.Context, userID string, roleID string) (annotations.Annotations, error)
RemoveUserRoleFunc func(ctx context.Context, userID string, roleID string) (annotations.Annotations, error)
GetSubjectsForAllRolesFunc func(ctx context.Context) (map[string][]string, error)
GetUserRolesFunc func(ctx context.Context, userID string) ([]string, error)
GetRoleSubjectsFunc func(ctx context.Context, roleID string) ([]string, error)
GetRoleUsersFunc func(ctx context.Context, roleID string) ([]*client.Account, error)
GetRBACConfigMapFunc func(ctx context.Context) (*corev1.ConfigMap, error)
}
MockClient is a mock implementation of the ArgoCD client for testing.
func (*MockClient) CreateAccount ¶
func (m *MockClient) CreateAccount(ctx context.Context, username string, password string) (*client.Account, annotations.Annotations, error)
CreateAccount calls the mock method if it is defined.
func (*MockClient) GetAccounts ¶
GetAccounts calls the mock method if it is defined.
func (*MockClient) GetDefaultRole ¶
func (m *MockClient) GetDefaultRole(ctx context.Context) (string, error)
GetDefaultRole calls the mock method if it is defined.
func (*MockClient) GetRBACConfigMap ¶ added in v0.1.0
GetRBACConfigMap calls the mock method if it is defined.
func (*MockClient) GetRoleSubjects ¶
GetRoleSubjects calls the mock method if it is defined.
func (*MockClient) GetRoleUsers ¶
GetRoleUsers calls the mock method if it is defined.
func (*MockClient) GetRoles ¶
func (m *MockClient) GetRoles(ctx context.Context) ([]*client.Role, annotations.Annotations, error)
GetRoles calls the mock method if it is defined.
func (*MockClient) GetSubjectsForAllRoles ¶
GetSubjectsForAllRoles calls the mock method if it is defined.
func (*MockClient) GetUserRoles ¶
GetUserRoles calls the mock method if it is defined.
func (*MockClient) RemoveUserRole ¶
func (m *MockClient) RemoveUserRole(ctx context.Context, userID string, roleID string) (annotations.Annotations, error)
RemoveUserRole calls the mock method if it is defined.
func (*MockClient) UpdateUserRole ¶
func (m *MockClient) UpdateUserRole(ctx context.Context, userID string, roleID string) (annotations.Annotations, error)
UpdateUserRole calls the mock method if it is defined.