setup

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Aug 19, 2026 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateClient

func CreateClient(t *testing.T, opts ...sdk.Option) *sdk.HTTPClient

CreateClient returns a fresh unauthenticated HTTP client

func CreateClientWithCookie

func CreateClientWithCookie(t *testing.T, cookie *http.Cookie) *sdk.HTTPClient

CreateClientWithCookie creates an SDK client with a specific cookie set on the refresh path

func FindRefreshCookie

func FindRefreshCookie(t *testing.T, jar *cookiejar.Jar) *http.Cookie

FindRefreshCookie finds the refresh_token cookie in the jar

func GenerateTestCredentials

func GenerateTestCredentials(t *testing.T, name string) (string, string)

GenerateTestCredentials generates unique email and password using nanosecond timestamps

func GetAccessToken

func GetAccessToken(t *testing.T, user *UserClient) string

GetAccessToken logs in with a fresh client and returns the raw access token

func GetPermissionByName

func GetPermissionByName(t *testing.T, client *sdk.HTTPClient, scope iam.Scope) sdk.Permission

GetPermissionByName finds a permission by name from the permissions list

func LoginUser

func LoginUser(t *testing.T, client *sdk.HTTPClient, email, password string) *sdk.LoginResponse

LoginUser logs in and returns the response. Fails the test on error.

Types

type UserClient

type UserClient struct {
	Client   *sdk.HTTPClient
	UserID   uuid.UUID
	TenantID uuid.UUID
	Email    string
	Password string
}

UserClient holds an authenticated SDK client with user metadata

func CreateAdminUser

func CreateAdminUser(t *testing.T, name string) *UserClient

CreateAdminUser creates a verified user with all permissions granted via direct assignment

func CreateUserInTenant

func CreateUserInTenant(t *testing.T, admin *UserClient, name string) *UserClient

CreateUserInTenant creates a user in an existing tenant via gRPC, verifies email, and logs in

func CreateUserInTenantWithRoles

func CreateUserInTenantWithRoles(t *testing.T, admin *UserClient, name string, roleIDs []uuid.UUID) *UserClient

CreateUserInTenantWithRoles creates a user with specific roles. NOT logged in (for MFA-required flows).

func CreateVerifiedUser

func CreateVerifiedUser(t *testing.T, name string, opts ...sdk.Option) *UserClient

CreateVerifiedUser registers a user, verifies email via DB token extraction, and returns an authenticated client

func CreateVerifiedUserWithJar

func CreateVerifiedUserWithJar(t *testing.T, name string) (*UserClient, *cookiejar.Jar)

CreateVerifiedUserWithJar creates a verified user with a controllable cookie jar

Jump to

Keyboard shortcuts

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