Documentation
¶
Index ¶
- Constants
- func CreateMockResponseBody(fileName string) io.ReadCloser
- func LoadMockJSON(fileName string) []byte
- func LoadMockStruct(fileName string, v interface{})
- func LoadMockTeamsStruct(fileName string, v interface{})
- func ReadFile(fileName string) string
- func ReadTeamsFile(fileName string) string
- type MockClient
- func (m *MockClient) AssignUserToTeam(ctx context.Context, teamUID, userUID string) (*client.AssignUserToTeamResponse, annotations.Annotations, error)
- func (m *MockClient) CreateUser(ctx context.Context, user client.UserPayload) (*client.CreateUserResponse, annotations.Annotations, error)
- func (m *MockClient) GetTeamUsers(ctx context.Context, teamID string) ([]*client.ZuperUser, string, annotations.Annotations, error)
- func (m *MockClient) GetTeams(ctx context.Context, options client.PageOptions) ([]*client.Team, string, annotations.Annotations, error)
- func (m *MockClient) GetUserByID(ctx context.Context, userUID string) (*client.ZuperUser, annotations.Annotations, error)
- func (m *MockClient) GetUsers(ctx context.Context, options client.PageOptions) ([]*client.ZuperUser, string, annotations.Annotations, error)
- func (m *MockClient) UnassignUserFromTeam(ctx context.Context, teamUID, userUID string) (*client.AssignUserToTeamResponse, annotations.Annotations, error)
- func (m *MockClient) UpdateUserAccessRole(ctx context.Context, userUID string, accessRoleUID string) (*client.UpdateUserRoleResponse, annotations.Annotations, error)
- func (m *MockClient) UpdateUserRole(ctx context.Context, userUID string, roleID int) (*client.UpdateUserRoleResponse, annotations.Annotations, error)
Constants ¶
const ( MockBaseURL = "https://mock.api.zuper.co" MockAccessToken = "mock-access-token" )
Mock constants.
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.
func LoadMockTeamsStruct ¶
func LoadMockTeamsStruct(fileName string, v interface{})
LoadMockTeamsStruct loads a mock JSON file and unmarshals it into the provided interface for teams.
func ReadTeamsFile ¶
ReadTeamsFile loads content from a JSON file from /test/mock/ for teams.
Types ¶
type MockClient ¶
type MockClient struct {
GetUsersFunc func(ctx context.Context, options client.PageOptions) ([]*client.ZuperUser, string, annotations.Annotations, error)
GetUserByIDFunc func(ctx context.Context, userUID string) (*client.ZuperUser, annotations.Annotations, error)
CreateUserFunc func(ctx context.Context, user client.UserPayload) (*client.CreateUserResponse, annotations.Annotations, error)
GetTeamsFunc func(ctx context.Context, options client.PageOptions) ([]*client.Team, string, annotations.Annotations, error)
GetTeamUsersFunc func(ctx context.Context, teamID string) ([]*client.ZuperUser, string, annotations.Annotations, error)
AssignUserToTeamFunc func(ctx context.Context, teamUID, userUID string) (*client.AssignUserToTeamResponse, annotations.Annotations, error)
UnassignUserFromTeamFunc func(ctx context.Context, teamUID, userUID string) (*client.AssignUserToTeamResponse, annotations.Annotations, error)
UpdateUserRoleFunc func(ctx context.Context, userUID string, roleID int) (*client.UpdateUserRoleResponse, annotations.Annotations, error)
UpdateUserAccessRoleFunc func(ctx context.Context, userUID string, accessRoleUID string) (*client.UpdateUserRoleResponse, annotations.Annotations, error)
}
MockClient is a mock implementation of the Zuper client for testing.
func (*MockClient) AssignUserToTeam ¶
func (m *MockClient) AssignUserToTeam(ctx context.Context, teamUID, userUID string) (*client.AssignUserToTeamResponse, annotations.Annotations, error)
AssignUserToTeam calls the mock method if it is defined.
func (*MockClient) CreateUser ¶
func (m *MockClient) CreateUser(ctx context.Context, user client.UserPayload) (*client.CreateUserResponse, annotations.Annotations, error)
CreateUser calls the mock method if it is defined.
func (*MockClient) GetTeamUsers ¶
func (m *MockClient) GetTeamUsers(ctx context.Context, teamID string) ([]*client.ZuperUser, string, annotations.Annotations, error)
GetTeamUsers calls the mock method if it is defined.
func (*MockClient) GetTeams ¶
func (m *MockClient) GetTeams(ctx context.Context, options client.PageOptions) ([]*client.Team, string, annotations.Annotations, error)
GetTeams calls the mock method if it is defined.
func (*MockClient) GetUserByID ¶
func (m *MockClient) GetUserByID(ctx context.Context, userUID string) (*client.ZuperUser, annotations.Annotations, error)
GetUserByID calls the mock method if it is defined.
func (*MockClient) GetUsers ¶
func (m *MockClient) GetUsers(ctx context.Context, options client.PageOptions) ([]*client.ZuperUser, string, annotations.Annotations, error)
GetUsers calls the mock method if it is defined.
func (*MockClient) UnassignUserFromTeam ¶
func (m *MockClient) UnassignUserFromTeam(ctx context.Context, teamUID, userUID string) (*client.AssignUserToTeamResponse, annotations.Annotations, error)
UnassignUserFromTeam calls the mock method if it is defined.
func (*MockClient) UpdateUserAccessRole ¶
func (m *MockClient) UpdateUserAccessRole(ctx context.Context, userUID string, accessRoleUID string) (*client.UpdateUserRoleResponse, annotations.Annotations, error)
func (*MockClient) UpdateUserRole ¶
func (m *MockClient) UpdateUserRole(ctx context.Context, userUID string, roleID int) (*client.UpdateUserRoleResponse, annotations.Annotations, error)
UpdateUserRole calls the mock method if it is defined.