Documentation
¶
Index ¶
- type DataFactory
- type Email
- type Group
- type GroupInput
- type GroupList
- type GroupMember
- type ListOpts
- type Name
- type PatchOp
- type Result
- func (r Result) Group() Group
- func (r Result) GroupList() GroupList
- func (r Result) RequireError(status int, scimType string) SCIMError
- func (r Result) RequireJSONContains(expected any) Result
- func (r Result) RequireJSONEq(expected any) Result
- func (r Result) RequireMissing(path string) Result
- func (r Result) RequirePath(path string, expected any) Result
- func (r Result) RequireStatus(status int) Result
- func (r Result) RequireSuccess() Result
- func (r Result) String() string
- func (r Result) User() User
- func (r Result) UserList() UserList
- type SCIMError
- type TestClient
- func (h *TestClient) CreateGroup(body any) Result
- func (h *TestClient) CreateUser(body any) Result
- func (h *TestClient) DeleteGroup(id string) Result
- func (h *TestClient) DeleteUser(id string) Result
- func (h *TestClient) GetGroup(id string, opts ...ListOpts) Result
- func (h *TestClient) GetResourceTypes() Result
- func (h *TestClient) GetSchemas() Result
- func (h *TestClient) GetServiceProviderConfig() Result
- func (h *TestClient) GetUser(id string, opts ...ListOpts) Result
- func (h *TestClient) ListGroups(opts ListOpts) Result
- func (h *TestClient) ListUsers(opts ListOpts) Result
- func (h *TestClient) MustCreateGroup(body any) Group
- func (h *TestClient) MustCreateUser(body any) User
- func (h *TestClient) MustDeleteGroup(id string)
- func (h *TestClient) MustDeleteUser(id string)
- func (h *TestClient) MustGetGroup(id string) Group
- func (h *TestClient) MustGetUser(id string) User
- func (h *TestClient) MustListGroups(opts ListOpts) GroupList
- func (h *TestClient) MustListUsers(opts ListOpts) UserList
- func (h *TestClient) MustPatchGroup(id string, body any)
- func (h *TestClient) MustPatchUser(id string, body any)
- func (h *TestClient) PatchGroup(id string, body any) Result
- func (h *TestClient) PatchThenGetGroup(id string, body any) Group
- func (h *TestClient) PatchThenGetUser(id string, body any) User
- func (h *TestClient) PatchUser(id string, body any) Result
- func (h *TestClient) ReplaceGroup(id string, body any) Result
- func (h *TestClient) ReplaceUser(id string, body any) Result
- type User
- type UserInput
- type UserList
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataFactory ¶
type DataFactory struct {
// contains filtered or unexported fields
}
DataFactory generates readable values that remain unique under parallel use.
func NewDataFactory ¶
func NewDataFactory(testName string) *DataFactory
func (*DataFactory) Group ¶
func (f *DataFactory) Group() GroupInput
func (*DataFactory) User ¶
func (f *DataFactory) User() UserInput
type Group ¶
type Group struct {
Schemas []string `json:"schemas"`
ID string `json:"id"`
DisplayName string `json:"displayName"`
ExternalID string `json:"externalId"`
Members []GroupMember `json:"members"`
}
type GroupInput ¶
type GroupInput struct {
Schemas []string `json:"schemas"`
DisplayName string `json:"displayName"`
ExternalID string `json:"externalId,omitempty"`
Members []GroupMember `json:"members,omitempty"`
}
type GroupMember ¶
type PatchOp ¶
type PatchOp struct {
Op string `json:"op"`
Path string `json:"path,omitempty"`
Value json.RawMessage `json:"value,omitempty"`
}
type Result ¶
type Result struct {
Status int
Header http.Header
Body []byte
// contains filtered or unexported fields
}
Result preserves the HTTP response for negative and protocol-level assertions.
func (Result) RequireJSONContains ¶
RequireJSONContains asserts that every key/value in expected appears in the response body. Extra fields on the server (id, meta, groups) are ignored. Nested objects are matched the same way. Arrays at a given path must match exactly.
func (Result) RequireJSONEq ¶
RequireJSONEq compares the entire response body with expected using testify JSONEq. Use only for frozen documents with no generated fields (typical: empty list, tiny errors).
func (Result) RequireMissing ¶
RequireMissing fails if the dotted JSON path exists on the response body.
func (Result) RequirePath ¶
RequirePath asserts one value at a dotted JSON path. Examples: "userName", "Resources.0.userName", "$.totalResults", "Resources[0].id".
func (Result) RequireStatus ¶
RequireStatus fails unless the HTTP status matches.
func (Result) RequireSuccess ¶
RequireSuccess fails unless the status is 2xx. Use for PATCH, where 200 and 204 are both valid.
type TestClient ¶
type TestClient struct {
Data *DataFactory
// contains filtered or unexported fields
}
TestClient keeps HTTP mechanics and the stable SCIM endpoint paths out of tests. Use Result directly for negative tests and the Must methods for successful flows.
func NewTestClient ¶
func NewTestClient(t *testing.T) *TestClient
func (*TestClient) CreateGroup ¶
func (h *TestClient) CreateGroup(body any) Result
func (*TestClient) CreateUser ¶
func (h *TestClient) CreateUser(body any) Result
func (*TestClient) DeleteGroup ¶
func (h *TestClient) DeleteGroup(id string) Result
func (*TestClient) DeleteUser ¶
func (h *TestClient) DeleteUser(id string) Result
func (*TestClient) GetResourceTypes ¶
func (h *TestClient) GetResourceTypes() Result
func (*TestClient) GetSchemas ¶
func (h *TestClient) GetSchemas() Result
func (*TestClient) GetServiceProviderConfig ¶
func (h *TestClient) GetServiceProviderConfig() Result
func (*TestClient) ListGroups ¶
func (h *TestClient) ListGroups(opts ListOpts) Result
func (*TestClient) ListUsers ¶
func (h *TestClient) ListUsers(opts ListOpts) Result
func (*TestClient) MustCreateGroup ¶
func (h *TestClient) MustCreateGroup(body any) Group
func (*TestClient) MustCreateUser ¶
func (h *TestClient) MustCreateUser(body any) User
func (*TestClient) MustDeleteGroup ¶
func (h *TestClient) MustDeleteGroup(id string)
func (*TestClient) MustDeleteUser ¶
func (h *TestClient) MustDeleteUser(id string)
func (*TestClient) MustGetGroup ¶
func (h *TestClient) MustGetGroup(id string) Group
func (*TestClient) MustGetUser ¶
func (h *TestClient) MustGetUser(id string) User
func (*TestClient) MustListGroups ¶
func (h *TestClient) MustListGroups(opts ListOpts) GroupList
func (*TestClient) MustListUsers ¶
func (h *TestClient) MustListUsers(opts ListOpts) UserList
func (*TestClient) MustPatchGroup ¶
func (h *TestClient) MustPatchGroup(id string, body any)
func (*TestClient) MustPatchUser ¶
func (h *TestClient) MustPatchUser(id string, body any)
func (*TestClient) PatchGroup ¶
func (h *TestClient) PatchGroup(id string, body any) Result
func (*TestClient) PatchThenGetGroup ¶
func (h *TestClient) PatchThenGetGroup(id string, body any) Group
func (*TestClient) PatchThenGetUser ¶
func (h *TestClient) PatchThenGetUser(id string, body any) User
func (*TestClient) PatchUser ¶
func (h *TestClient) PatchUser(id string, body any) Result
PatchUser accepts either []PatchOp, one PatchOp, json.RawMessage, or any JSON-marshalable complete PATCH document.
func (*TestClient) ReplaceGroup ¶
func (h *TestClient) ReplaceGroup(id string, body any) Result
func (*TestClient) ReplaceUser ¶
func (h *TestClient) ReplaceUser(id string, body any) Result