Documentation
¶
Index ¶
- Constants
- func CreateMockResponse(fileName string) *http.Response
- func CreateMockResponseBody(fileName string) io.ReadCloser
- func NewTestClient(response *http.Response, err error) *client.Client
- func ReadFile(fileName string) string
- type ExtendedMockClient
- type MockClient
- func (m *MockClient) CreateUsers(ctx context.Context, request client.CreateUsersRequest) (*client.UserCreationResponse, annotations.Annotations, error)
- func (m *MockClient) GetGroupUsers(ctx context.Context, groupID string, opts client.PageOptions) ([]client.User, string, annotations.Annotations, error)
- func (m *MockClient) GetGroups(ctx context.Context, opts client.PageOptions) ([]client.Group, string, annotations.Annotations, error)
- func (m *MockClient) GetUsers(ctx context.Context, opts client.PageOptions) ([]client.User, string, annotations.Annotations, error)
- type MockRoundTripper
Constants ¶
const ( MockAccountID = "account123" MockBaseURL = "https://mock.api.docusign.net" MockAccessToken = "test-token" MockRefreshToken = "test-refresh-token" MockUserID = "u1" MockGroupID = "g1" )
Variables ¶
This section is empty.
Functions ¶
func CreateMockResponse ¶
CreateMockResponse creates a mock HTTP response with a status and mock response body.
func CreateMockResponseBody ¶
func CreateMockResponseBody(fileName string) io.ReadCloser
CreateMockResponseBody creates a mock response body by reading a file.
func NewTestClient ¶
NewTestClient prepares a Client pointing to a mock endpoint.
Types ¶
type ExtendedMockClient ¶
type ExtendedMockClient struct {
*MockClient
GetAllUsersWithDetailsFunc func(ctx context.Context) ([]*client.UserDetail, annotations.Annotations, error)
}
ExtendedMockClient is an extended version of MockClient with additional functionality for user details.
func (*ExtendedMockClient) GetAllUsersWithDetails ¶
func (m *ExtendedMockClient) GetAllUsersWithDetails(ctx context.Context) ([]*client.UserDetail, annotations.Annotations, error)
GetAllUsersWithDetails returns user details for all users, based on the mocked function.
type MockClient ¶
type MockClient struct {
GetUsersFunc func(ctx context.Context, opts client.PageOptions) ([]client.User, string, annotations.Annotations, error)
GetGroupsFunc func(ctx context.Context, opts client.PageOptions) ([]client.Group, string, annotations.Annotations, error)
GetGroupUsersFunc func(ctx context.Context, groupID string, opts client.PageOptions) ([]client.User, string, annotations.Annotations, error)
CreateUsersFunc func(ctx context.Context, request client.CreateUsersRequest) (*client.UserCreationResponse, annotations.Annotations, error)
}
MockClient is a mock client used for unit tests that simulates the real client behavior.
func (*MockClient) CreateUsers ¶
func (m *MockClient) CreateUsers(ctx context.Context, request client.CreateUsersRequest) (*client.UserCreationResponse, annotations.Annotations, error)
CreateUsers creates users based on the mocked function.
func (*MockClient) GetGroupUsers ¶
func (m *MockClient) GetGroupUsers(ctx context.Context, groupID string, opts client.PageOptions) ([]client.User, string, annotations.Annotations, error)
GetGroupUsers returns a list of users for a given group based on the mocked function.
func (*MockClient) GetGroups ¶
func (m *MockClient) GetGroups(ctx context.Context, opts client.PageOptions) ([]client.Group, string, annotations.Annotations, error)
GetGroups returns a list of groups based on the mocked function.
func (*MockClient) GetUsers ¶
func (m *MockClient) GetUsers(ctx context.Context, opts client.PageOptions) ([]client.User, string, annotations.Annotations, error)
GetUsers returns a list of users based on the mocked function.
type MockRoundTripper ¶
type MockRoundTripper struct {
Response *http.Response
Err error
// contains filtered or unexported fields
}
MockRoundTripper is a mock implementation of http.RoundTripper for testing.