e2e

package
v0.0.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 19, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

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 Email

type Email struct {
	Value   string `json:"value"`
	Type    string `json:"type"`
	Primary bool   `json:"primary"`
}

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 GroupList

type GroupList struct {
	Schemas      []string `json:"schemas"`
	TotalResults int      `json:"totalResults"`
	Resources    []Group  `json:"Resources"`
	StartIndex   int      `json:"startIndex"`
	ItemsPerPage int      `json:"itemsPerPage"`
}

type GroupMember

type GroupMember struct {
	Value   string `json:"value"`
	Display string `json:"display"`
	Ref     string `json:"$ref"`
	Type    string `json:"type"`
}

type ListOpts

type ListOpts struct {
	Filter             string
	StartIndex         int
	Count              *int
	Attributes         []string
	ExcludedAttributes []string
}

type Name

type Name struct {
	GivenName  string `json:"givenName"`
	FamilyName string `json:"familyName"`
}

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) Group

func (r Result) Group() Group

func (Result) GroupList

func (r Result) GroupList() GroupList

func (Result) RequireError

func (r Result) RequireError(status int, scimType string) SCIMError

func (Result) RequireJSONContains

func (r Result) RequireJSONContains(expected any) Result

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

func (r Result) RequireJSONEq(expected any) Result

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

func (r Result) RequireMissing(path string) Result

RequireMissing fails if the dotted JSON path exists on the response body.

func (Result) RequirePath

func (r Result) RequirePath(path string, expected any) Result

RequirePath asserts one value at a dotted JSON path. Examples: "userName", "Resources.0.userName", "$.totalResults", "Resources[0].id".

func (Result) RequireStatus

func (r Result) RequireStatus(status int) Result

RequireStatus fails unless the HTTP status matches.

func (Result) RequireSuccess

func (r Result) RequireSuccess() Result

RequireSuccess fails unless the status is 2xx. Use for PATCH, where 200 and 204 are both valid.

func (Result) String

func (r Result) String() string

func (Result) User

func (r Result) User() User

func (Result) UserList

func (r Result) UserList() UserList

type SCIMError

type SCIMError struct {
	Schemas  []string `json:"schemas"`
	SCIMType string   `json:"scimType"`
	Detail   string   `json:"detail"`
	Status   int      `json:"status"`
}

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) GetGroup

func (h *TestClient) GetGroup(id string, opts ...ListOpts) 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) GetUser

func (h *TestClient) GetUser(id string, opts ...ListOpts) 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

type User

type User struct {
	Schemas     []string `json:"schemas"`
	ID          string   `json:"id"`
	ExternalID  string   `json:"externalId"`
	UserName    string   `json:"userName"`
	DisplayName string   `json:"displayName"`
	Active      bool     `json:"active"`
	Name        Name     `json:"name"`
	Emails      []Email  `json:"emails"`
}

type UserInput

type UserInput struct {
	Schemas     []string `json:"schemas"`
	UserName    string   `json:"userName"`
	ExternalID  string   `json:"externalId,omitempty"`
	DisplayName string   `json:"displayName,omitempty"`
	Active      bool     `json:"active"`
	Name        Name     `json:"name,omitempty"`
	Emails      []Email  `json:"emails,omitempty"`
}

type UserList

type UserList struct {
	Schemas      []string `json:"schemas"`
	TotalResults int      `json:"totalResults"`
	Resources    []User   `json:"Resources"`
	StartIndex   int      `json:"startIndex"`
	ItemsPerPage int      `json:"itemsPerPage"`
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL