mocks

package
v0.27.0 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateMockResponse

func CreateMockResponse(statusCode int, body string, headers map[string]string) *http.Response

CreateMockResponse creates a mock HTTP response for testing

func NewMockAuthConfig

func NewMockAuthConfig() *auth.Config

NewMockAuthConfig creates a mock auth configuration for testing

Types

type AuthClientInterface

type AuthClientInterface interface {
	ValidateToken(ctx context.Context, token string) (*AuthUser, error)
	RefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error)
	GetUserClaims(ctx context.Context, token string) (*UserClaims, error)
	CheckPermissions(ctx context.Context, userID string, orgID string, permission string) (bool, error)
	CreateUser(ctx context.Context, email string, password string, metadata map[string]any) (*AuthUser, error)
	SignIn(ctx context.Context, email string, password string) (*TokenResponse, error)
	SignOut(ctx context.Context, token string) error
}

AuthClientInterface defines the interface for authentication client operations

type AuthUser

type AuthUser struct {
	ID           string         `json:"id"`
	Email        string         `json:"email"`
	FullName     string         `json:"full_name,omitempty"`
	Metadata     map[string]any `json:"user_metadata,omitempty"`
	AppMetadata  map[string]any `json:"app_metadata,omitempty"`
	CreatedAt    string         `json:"created_at"`
	UpdatedAt    string         `json:"updated_at"`
	LastSignInAt string         `json:"last_sign_in_at,omitempty"`
}

AuthUser represents an authenticated user for testing

type HTTPClientInterface

type HTTPClientInterface interface {
	Do(req *http.Request) (*http.Response, error)
	Get(url string) (*http.Response, error)
	Post(url, contentType string, body any) (*http.Response, error)
	PostForm(url string, data any) (*http.Response, error)
	Head(url string) (*http.Response, error)
}

HTTPClientInterface defines the interface for HTTP client operations

type MockAuthClient

type MockAuthClient struct {
	mock.Mock
}

MockAuthClient is a mock implementation of an authentication client

func (*MockAuthClient) CheckPermissions

func (m *MockAuthClient) CheckPermissions(ctx context.Context, userID string, orgID string, permission string) (bool, error)

CheckPermissions mocks organisation role permission checks

func (*MockAuthClient) CreateUser

func (m *MockAuthClient) CreateUser(ctx context.Context, email string, password string, metadata map[string]any) (*AuthUser, error)

CreateUser mocks user registration functionality

func (*MockAuthClient) GetUserClaims

func (m *MockAuthClient) GetUserClaims(ctx context.Context, token string) (*UserClaims, error)

GetUserClaims mocks extracting user claims from JWT token

func (*MockAuthClient) RefreshToken

func (m *MockAuthClient) RefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error)

RefreshToken mocks token refresh functionality

func (*MockAuthClient) SignIn

func (m *MockAuthClient) SignIn(ctx context.Context, email string, password string) (*TokenResponse, error)

SignIn mocks user sign-in functionality

func (*MockAuthClient) SignOut

func (m *MockAuthClient) SignOut(ctx context.Context, token string) error

SignOut mocks user sign-out functionality

func (*MockAuthClient) ValidateToken

func (m *MockAuthClient) ValidateToken(ctx context.Context, token string) (*AuthUser, error)

ValidateToken mocks JWT token validation

type MockAuthMiddleware

type MockAuthMiddleware struct {
	mock.Mock
}

MockAuthMiddleware is a mock for authentication middleware testing

func (*MockAuthMiddleware) ExtractTokenFromRequest

func (m *MockAuthMiddleware) ExtractTokenFromRequest(r *http.Request) (string, error)

ExtractTokenFromRequest mocks token extraction from HTTP request

func (*MockAuthMiddleware) Middleware

func (m *MockAuthMiddleware) Middleware(next http.Handler) http.Handler

Middleware mocks the authentication middleware handler

func (*MockAuthMiddleware) SetUserInContext

func (m *MockAuthMiddleware) SetUserInContext(r *http.Request, user *AuthUser) *http.Request

SetUserInContext mocks setting user context in HTTP request

type MockCrawler

type MockCrawler struct {
	mock.Mock
}

MockCrawler is a mock implementation of the Crawler

func (*MockCrawler) DiscoverSitemapsAndRobots

func (m *MockCrawler) DiscoverSitemapsAndRobots(ctx context.Context, domain string) (*crawler.SitemapDiscoveryResult, error)

DiscoverSitemapsAndRobots mocks the DiscoverSitemapsAndRobots method

func (*MockCrawler) FilterURLs

func (m *MockCrawler) FilterURLs(urls []string, includePaths, excludePaths []string) []string

FilterURLs mocks the FilterURLs method

func (*MockCrawler) GetUserAgent

func (m *MockCrawler) GetUserAgent() string

GetUserAgent mocks the GetUserAgent method

func (*MockCrawler) ParseSitemap

func (m *MockCrawler) ParseSitemap(ctx context.Context, sitemapURL string) ([]string, error)

ParseSitemap mocks the ParseSitemap method

func (*MockCrawler) WarmURL

func (m *MockCrawler) WarmURL(ctx context.Context, url string, findLinks bool) (*crawler.CrawlResult, error)

WarmURL mocks the WarmURL method

type MockDB

type MockDB struct {
	mock.Mock
}

MockDB is a mock implementation of the database interface

func (*MockDB) AcceptOrganisationInvite

func (m *MockDB) AcceptOrganisationInvite(ctx context.Context, token, userID string) (*db.OrganisationInvite, error)

AcceptOrganisationInvite mocks invite acceptance

func (*MockDB) AddOrganisationMember

func (m *MockDB) AddOrganisationMember(userID, organisationID, role string) error

AddOrganisationMember mocks the AddOrganisationMember method

func (*MockDB) Close

func (m *MockDB) Close() error

Close mocks the Close method for database connection cleanup

func (*MockDB) CountOrganisationAdmins

func (m *MockDB) CountOrganisationAdmins(ctx context.Context, organisationID string) (int, error)

CountOrganisationAdmins mocks admin counting

func (*MockDB) CreateGoogleConnection

func (m *MockDB) CreateGoogleConnection(ctx context.Context, conn *db.GoogleAnalyticsConnection) error

func (*MockDB) CreateOrUpdateSiteSetting

func (m *MockDB) CreateOrUpdateSiteSetting(ctx context.Context, setting *db.WebflowSiteSetting) error

func (*MockDB) CreateOrganisation

func (m *MockDB) CreateOrganisation(name string) (*db.Organisation, error)

CreateOrganisation mocks the CreateOrganisation method

func (*MockDB) CreateOrganisationInvite

func (m *MockDB) CreateOrganisationInvite(ctx context.Context, invite *db.OrganisationInvite) (*db.OrganisationInvite, error)

CreateOrganisationInvite mocks invite creation

func (*MockDB) CreateScheduler

func (m *MockDB) CreateScheduler(ctx context.Context, scheduler *db.Scheduler) error

CreateScheduler mocks the CreateScheduler method

func (*MockDB) CreateSlackConnection

func (m *MockDB) CreateSlackConnection(ctx context.Context, conn *db.SlackConnection) error
func (m *MockDB) CreateSlackUserLink(ctx context.Context, link *db.SlackUserLink) error

func (*MockDB) CreateUser

func (m *MockDB) CreateUser(userID, email string, firstName, lastName, fullName *string, orgName string) (*db.User, *db.Organisation, error)

CreateUser mocks creating a user and organisation

func (*MockDB) CreateWebflowConnection

func (m *MockDB) CreateWebflowConnection(ctx context.Context, conn *db.WebflowConnection) error

Webflow integration mock methods

func (*MockDB) DeleteGoogleConnection

func (m *MockDB) DeleteGoogleConnection(ctx context.Context, connectionID, organisationID string) error

func (*MockDB) DeleteScheduler

func (m *MockDB) DeleteScheduler(ctx context.Context, schedulerID string) error

DeleteScheduler mocks the DeleteScheduler method

func (*MockDB) DeleteSiteSetting

func (m *MockDB) DeleteSiteSetting(ctx context.Context, orgID, siteID string) error

func (*MockDB) DeleteSiteSettingsByConnection

func (m *MockDB) DeleteSiteSettingsByConnection(ctx context.Context, connectionID string) error

func (*MockDB) DeleteSlackConnection

func (m *MockDB) DeleteSlackConnection(ctx context.Context, connectionID, organisationID string) error
func (m *MockDB) DeleteSlackUserLink(ctx context.Context, userID, connectionID string) error

func (*MockDB) DeleteWebflowConnection

func (m *MockDB) DeleteWebflowConnection(ctx context.Context, connectionID, organisationID string) error

func (*MockDB) GetActivePlans

func (m *MockDB) GetActivePlans(ctx context.Context) ([]db.Plan, error)

func (*MockDB) GetConfig

func (m *MockDB) GetConfig() *db.Config

GetConfig mocks the GetConfig method to return database configuration

func (*MockDB) GetDB

func (m *MockDB) GetDB() *sql.DB

GetDB mocks the GetDB method to return underlying *sql.DB

func (*MockDB) GetDomainNameByID

func (m *MockDB) GetDomainNameByID(ctx context.Context, domainID int) (string, error)

GetDomainNameByID mocks the GetDomainNameByID method

func (*MockDB) GetDomainNames

func (m *MockDB) GetDomainNames(ctx context.Context, domainIDs []int) (map[int]string, error)

GetDomainNames mocks the GetDomainNames method

func (*MockDB) GetDomainsForOrganisation

func (m *MockDB) GetDomainsForOrganisation(ctx context.Context, organisationID string) ([]db.OrganisationDomain, error)

GetDomainsForOrganisation mocks the GetDomainsForOrganisation method

func (*MockDB) GetEffectiveOrganisationID

func (m *MockDB) GetEffectiveOrganisationID(user *db.User) string

GetEffectiveOrganisationID mocks the GetEffectiveOrganisationID method

func (*MockDB) GetExternalRedirects

func (m *MockDB) GetExternalRedirects(organisationID string, startDate, endDate *time.Time) ([]db.ExternalRedirect, error)

GetExternalRedirects mocks the GetExternalRedirects method

func (*MockDB) GetGoogleConnection

func (m *MockDB) GetGoogleConnection(ctx context.Context, connectionID string) (*db.GoogleAnalyticsConnection, error)

func (*MockDB) GetGoogleToken

func (m *MockDB) GetGoogleToken(ctx context.Context, connectionID string) (string, error)

func (*MockDB) GetJobActivity

func (m *MockDB) GetJobActivity(organisationID string, startDate, endDate *time.Time) ([]db.ActivityPoint, error)

GetJobActivity mocks the GetJobActivity method

func (*MockDB) GetJobStats

func (m *MockDB) GetJobStats(organisationID string, startDate, endDate *time.Time) (*db.JobStats, error)

GetJobStats mocks the GetJobStats method

func (*MockDB) GetLastJobStartTimeForScheduler

func (m *MockDB) GetLastJobStartTimeForScheduler(ctx context.Context, schedulerID string) (*time.Time, error)

GetLastJobStartTimeForScheduler mocks the GetLastJobStartTimeForScheduler method

func (*MockDB) GetOrCreateDomainID

func (m *MockDB) GetOrCreateDomainID(ctx context.Context, domain string) (int, error)

GetOrCreateDomainID mocks the GetOrCreateDomainID method

func (*MockDB) GetOrCreateUser

func (m *MockDB) GetOrCreateUser(userID, email string, orgID *string) (*db.User, error)

GetOrCreateUser mocks the GetOrCreateUser method

func (*MockDB) GetOrganisation

func (m *MockDB) GetOrganisation(organisationID string) (*db.Organisation, error)

GetOrganisation mocks retrieving an organisation by ID

func (*MockDB) GetOrganisationInviteByToken

func (m *MockDB) GetOrganisationInviteByToken(ctx context.Context, token string) (*db.OrganisationInvite, error)

GetOrganisationInviteByToken mocks invite lookup

func (*MockDB) GetOrganisationMemberRole

func (m *MockDB) GetOrganisationMemberRole(ctx context.Context, userID, organisationID string) (string, error)

GetOrganisationMemberRole mocks role lookups

func (*MockDB) GetOrganisationPlanID

func (m *MockDB) GetOrganisationPlanID(ctx context.Context, organisationID string) (string, error)

GetOrganisationPlanID mocks plan retrieval

func (*MockDB) GetOrganisationUsageStats

func (m *MockDB) GetOrganisationUsageStats(ctx context.Context, orgID string) (*db.UsageStats, error)

func (*MockDB) GetPlatformOrgMapping

func (m *MockDB) GetPlatformOrgMapping(ctx context.Context, platform, platformID string) (*db.PlatformOrgMapping, error)

func (*MockDB) GetScheduler

func (m *MockDB) GetScheduler(ctx context.Context, schedulerID string) (*db.Scheduler, error)

GetScheduler mocks the GetScheduler method

func (*MockDB) GetSchedulersReadyToRun

func (m *MockDB) GetSchedulersReadyToRun(ctx context.Context, limit int) ([]*db.Scheduler, error)

GetSchedulersReadyToRun mocks the GetSchedulersReadyToRun method

func (*MockDB) GetSiteSetting

func (m *MockDB) GetSiteSetting(ctx context.Context, orgID, siteID string) (*db.WebflowSiteSetting, error)

func (*MockDB) GetSiteSettingByID

func (m *MockDB) GetSiteSettingByID(ctx context.Context, settingID string) (*db.WebflowSiteSetting, error)

func (*MockDB) GetSiteSettingBySiteID

func (m *MockDB) GetSiteSettingBySiteID(ctx context.Context, orgID, webflowSiteID string) (*db.WebflowSiteSetting, error)

func (*MockDB) GetSlackConnection

func (m *MockDB) GetSlackConnection(ctx context.Context, connectionID string) (*db.SlackConnection, error)

func (*MockDB) GetSlackToken

func (m *MockDB) GetSlackToken(ctx context.Context, connectionID string) (string, error)
func (m *MockDB) GetSlackUserLink(ctx context.Context, userID, connectionID string) (*db.SlackUserLink, error)

func (*MockDB) GetSlowPages

func (m *MockDB) GetSlowPages(organisationID string, startDate, endDate *time.Time) ([]db.SlowPage, error)

GetSlowPages mocks the GetSlowPages method

func (*MockDB) GetUnreadNotificationCount

func (m *MockDB) GetUnreadNotificationCount(ctx context.Context, organisationID string) (int, error)

func (*MockDB) GetUser

func (m *MockDB) GetUser(userID string) (*db.User, error)

GetUser mocks retrieving a user by ID

func (*MockDB) GetUserByWebhookToken

func (m *MockDB) GetUserByWebhookToken(token string) (*db.User, error)

GetUserByWebhookToken mocks the GetUserByWebhookToken method

func (*MockDB) GetWebflowConnection

func (m *MockDB) GetWebflowConnection(ctx context.Context, connectionID string) (*db.WebflowConnection, error)

func (*MockDB) GetWebflowToken

func (m *MockDB) GetWebflowToken(ctx context.Context, connectionID string) (string, error)

func (*MockDB) IsOrganisationMemberEmail

func (m *MockDB) IsOrganisationMemberEmail(ctx context.Context, organisationID, email string) (bool, error)

IsOrganisationMemberEmail mocks email membership checks

func (*MockDB) ListAllSiteSettings

func (m *MockDB) ListAllSiteSettings(ctx context.Context, orgID string) ([]*db.WebflowSiteSetting, error)

func (*MockDB) ListConfiguredSiteSettings

func (m *MockDB) ListConfiguredSiteSettings(ctx context.Context, orgID string) ([]*db.WebflowSiteSetting, error)

func (*MockDB) ListDailyUsage

func (m *MockDB) ListDailyUsage(ctx context.Context, organisationID string, startDate, endDate time.Time) ([]db.DailyUsageEntry, error)

ListDailyUsage mocks daily usage history

func (*MockDB) ListGoogleConnections

func (m *MockDB) ListGoogleConnections(ctx context.Context, organisationID string) ([]*db.GoogleAnalyticsConnection, error)

func (*MockDB) ListJobs

func (m *MockDB) ListJobs(organisationID string, limit, offset int, status, dateRange, timezone string) ([]db.JobWithDomain, int, error)

ListJobs mocks listing jobs with pagination and filters

func (*MockDB) ListJobsWithOffset

func (m *MockDB) ListJobsWithOffset(organisationID string, limit, offset int, status, dateRange string, tzOffsetMinutes int, includeStats bool) ([]db.JobWithDomain, int, error)

func (*MockDB) ListNotifications

func (m *MockDB) ListNotifications(ctx context.Context, organisationID string, limit, offset int, unreadOnly bool) ([]*db.Notification, int, error)

func (*MockDB) ListOrganisationInvites

func (m *MockDB) ListOrganisationInvites(ctx context.Context, organisationID string) ([]db.OrganisationInvite, error)

ListOrganisationInvites mocks invite listing

func (*MockDB) ListOrganisationMembers

func (m *MockDB) ListOrganisationMembers(ctx context.Context, organisationID string) ([]db.OrganisationMember, error)

ListOrganisationMembers mocks member listing

func (*MockDB) ListSchedulers

func (m *MockDB) ListSchedulers(ctx context.Context, organisationID string) ([]*db.Scheduler, error)

ListSchedulers mocks the ListSchedulers method

func (*MockDB) ListSiteSettingsByConnection

func (m *MockDB) ListSiteSettingsByConnection(ctx context.Context, connectionID string) ([]*db.WebflowSiteSetting, error)

func (*MockDB) ListSlackConnections

func (m *MockDB) ListSlackConnections(ctx context.Context, organisationID string) ([]*db.SlackConnection, error)

func (*MockDB) ListUserOrganisations

func (m *MockDB) ListUserOrganisations(userID string) ([]db.UserOrganisation, error)

ListUserOrganisations mocks the ListUserOrganisations method

func (*MockDB) ListWebflowConnections

func (m *MockDB) ListWebflowConnections(ctx context.Context, organisationID string) ([]*db.WebflowConnection, error)

func (*MockDB) MarkAllNotificationsRead

func (m *MockDB) MarkAllNotificationsRead(ctx context.Context, organisationID string) error

func (*MockDB) MarkNotificationRead

func (m *MockDB) MarkNotificationRead(ctx context.Context, notificationID, organisationID string) error

func (*MockDB) RecalculateJobStats

func (m *MockDB) RecalculateJobStats(ctx context.Context, jobID string) error

RecalculateJobStats mocks the RecalculateJobStats method

func (*MockDB) RemoveOrganisationMember

func (m *MockDB) RemoveOrganisationMember(ctx context.Context, userID, organisationID string) error

RemoveOrganisationMember mocks member removal

func (*MockDB) ResetDataOnly

func (m *MockDB) ResetDataOnly() error

ResetDataOnly mocks the ResetDataOnly method for testing data-only resets

func (*MockDB) ResetSchema

func (m *MockDB) ResetSchema() error

ResetSchema mocks the ResetSchema method for testing database resets

func (*MockDB) RevokeOrganisationInvite

func (m *MockDB) RevokeOrganisationInvite(ctx context.Context, inviteID, organisationID string) error

RevokeOrganisationInvite mocks invite revocation

func (*MockDB) SetActiveOrganisation

func (m *MockDB) SetActiveOrganisation(userID, organisationID string) error

SetActiveOrganisation mocks the SetActiveOrganisation method

func (*MockDB) SetOrganisationPlan

func (m *MockDB) SetOrganisationPlan(ctx context.Context, organisationID, planID string) error

SetOrganisationPlan mocks plan updates

func (*MockDB) StoreGoogleToken

func (m *MockDB) StoreGoogleToken(ctx context.Context, connectionID, token string) error

func (*MockDB) StoreSlackToken

func (m *MockDB) StoreSlackToken(ctx context.Context, connectionID, token string) error

func (*MockDB) StoreWebflowToken

func (m *MockDB) StoreWebflowToken(ctx context.Context, connectionID, token string) error

func (*MockDB) UpdateGoogleConnectionStatus

func (m *MockDB) UpdateGoogleConnectionStatus(ctx context.Context, connectionID, organisationID, status string) error

func (*MockDB) UpdateOrganisationMemberRole

func (m *MockDB) UpdateOrganisationMemberRole(ctx context.Context, userID, organisationID, role string) error

UpdateOrganisationMemberRole mocks member role updates

func (*MockDB) UpdateScheduler

func (m *MockDB) UpdateScheduler(ctx context.Context, schedulerID string, updates *db.Scheduler, expectedIsEnabled *bool) error

UpdateScheduler mocks the UpdateScheduler method

func (*MockDB) UpdateSchedulerNextRun

func (m *MockDB) UpdateSchedulerNextRun(ctx context.Context, schedulerID string, nextRun time.Time) error

UpdateSchedulerNextRun mocks the UpdateSchedulerNextRun method

func (*MockDB) UpdateSiteAutoPublish

func (m *MockDB) UpdateSiteAutoPublish(ctx context.Context, orgID, siteID string, enabled bool, webhookID string) error

func (*MockDB) UpdateSiteSchedule

func (m *MockDB) UpdateSiteSchedule(ctx context.Context, orgID, siteID string, intervalHours *int, schedulerID string) error

func (*MockDB) UpdateSlackUserLinkNotifications

func (m *MockDB) UpdateSlackUserLinkNotifications(ctx context.Context, userID, connectionID string, dmNotifications bool) error

func (*MockDB) UpdateUserNames

func (m *MockDB) UpdateUserNames(userID string, firstName, lastName, fullName *string) error

UpdateUserNames mocks updating user name fields

func (*MockDB) UpsertOrganisationDomain

func (m *MockDB) UpsertOrganisationDomain(ctx context.Context, organisationID string, domainID int) error

UpsertOrganisationDomain mocks the UpsertOrganisationDomain method

func (*MockDB) UpsertPlatformOrgMapping

func (m *MockDB) UpsertPlatformOrgMapping(ctx context.Context, mapping *db.PlatformOrgMapping) error

func (*MockDB) ValidateOrganisationMembership

func (m *MockDB) ValidateOrganisationMembership(userID, organisationID string) (bool, error)

ValidateOrganisationMembership mocks the ValidateOrganisationMembership method

type MockDbQueue

type MockDbQueue struct {
	mock.Mock
}

MockDbQueue is a mock implementation of DbQueueProvider

func (*MockDbQueue) CleanupStuckJobs

func (m *MockDbQueue) CleanupStuckJobs(ctx context.Context) error

CleanupStuckJobs mocks the CleanupStuckJobs method

func (*MockDbQueue) CreatePageRecords

func (m *MockDbQueue) CreatePageRecords(ctx context.Context, dbQueue *db.DbQueue, domainID int, domain string, urls []string) ([]int, []string, error)

CreatePageRecords mocks the CreatePageRecords method

func (*MockDbQueue) EnqueueURLs

func (m *MockDbQueue) EnqueueURLs(ctx context.Context, jobID string, pages []db.Page, sourceType string, sourceURL string) error

EnqueueURLs mocks the EnqueueURLs method

func (*MockDbQueue) Execute

func (m *MockDbQueue) Execute(ctx context.Context, fn func(*sql.Tx) error) error

Execute mocks the Execute method

func (*MockDbQueue) ExecuteMaintenance

func (m *MockDbQueue) ExecuteMaintenance(ctx context.Context, fn func(*sql.Tx) error) error

ExecuteMaintenance mocks the ExecuteMaintenance method

func (*MockDbQueue) GetNextTask

func (m *MockDbQueue) GetNextTask(ctx context.Context, jobID string) (*db.Task, error)

GetNextTask mocks the GetNextTask method

func (*MockDbQueue) UpdateTaskStatus

func (m *MockDbQueue) UpdateTaskStatus(ctx context.Context, task *db.Task) error

UpdateTaskStatus mocks the UpdateTaskStatus method

type MockHTTPClient

type MockHTTPClient struct {
	mock.Mock
}

MockHTTPClient is a mock implementation of HTTP client interface

func NewMockHTTPClientWithTimeout

func NewMockHTTPClientWithTimeout(timeout time.Duration) *MockHTTPClient

NewMockHTTPClientWithTimeout creates a mock HTTP client with timeout configuration

func (*MockHTTPClient) Do

func (m *MockHTTPClient) Do(req *http.Request) (*http.Response, error)

Do mocks the Do method of http.Client

func (*MockHTTPClient) Get

func (m *MockHTTPClient) Get(url string) (*http.Response, error)

Get mocks the Get method of http.Client

func (*MockHTTPClient) Head

func (m *MockHTTPClient) Head(url string) (*http.Response, error)

Head mocks the Head method of http.Client

func (*MockHTTPClient) Post

func (m *MockHTTPClient) Post(url, contentType string, body any) (*http.Response, error)

Post mocks the Post method of http.Client

func (*MockHTTPClient) PostForm

func (m *MockHTTPClient) PostForm(url string, data any) (*http.Response, error)

PostForm mocks the PostForm method of http.Client

type MockRoundTripper

type MockRoundTripper struct {
	mock.Mock
}

MockRoundTripper is a mock implementation of http.RoundTripper interface

func (*MockRoundTripper) RoundTrip

func (m *MockRoundTripper) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip mocks the RoundTrip method of http.RoundTripper

type MockSupabaseClient

type MockSupabaseClient struct {
	mock.Mock
}

MockSupabaseClient is a mock for Supabase authentication client

func (*MockSupabaseClient) Auth

Auth mocks the Auth method to return auth client

type MockTransport

type MockTransport struct {
	mock.Mock
}

MockTransport is a mock implementation for HTTP transport testing

func (*MockTransport) RoundTrip

func (m *MockTransport) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip implements http.RoundTripper interface for transport mocking

type MockWorkerPool

type MockWorkerPool struct {
	mock.Mock
}

MockWorkerPool is a mock implementation of WorkerPool

func (*MockWorkerPool) CancelJobTasks

func (m *MockWorkerPool) CancelJobTasks(jobID string) error

CancelJobTasks mocks the CancelJobTasks method

func (*MockWorkerPool) Start

func (m *MockWorkerPool) Start(ctx context.Context) error

Start mocks the Start method

func (*MockWorkerPool) Stop

func (m *MockWorkerPool) Stop() error

Stop mocks the Stop method

type TokenResponse

type TokenResponse struct {
	AccessToken  string    `json:"access_token"`
	TokenType    string    `json:"token_type"`
	ExpiresIn    int       `json:"expires_in"`
	RefreshToken string    `json:"refresh_token,omitempty"`
	User         *AuthUser `json:"user,omitempty"`
}

TokenResponse represents authentication tokens for testing

type UserClaims

type UserClaims struct {
	Sub           string         `json:"sub"`   // User ID
	Email         string         `json:"email"` // User email
	EmailVerified bool           `json:"email_verified"`
	Role          string         `json:"role,omitempty"`
	UserMetadata  map[string]any `json:"user_metadata,omitempty"`
	AppMetadata   map[string]any `json:"app_metadata,omitempty"`
	Aud           string         `json:"aud"` // Audience
	Iss           string         `json:"iss"` // Issuer
	Iat           int64          `json:"iat"` // Issued at
	Exp           int64          `json:"exp"` // Expires at
}

UserClaims represents JWT token claims for testing

Jump to

Keyboard shortcuts

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