test

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2025 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const ErrorEventResultId = "$ERROR"

Variables

View Source
var SimulatedError = errors.New("simulated error")

Functions

func MustMakeAuditQueue

func MustMakeAuditQueue(size int) *audit.Queue

func MustMakePDU

func MustMakePDU(event *BaseClientEvent) gomatrixserverlib.PDU

Types

type BaseClientEvent

type BaseClientEvent struct {
	RoomId      string         `json:"room_id"`
	EventId     string         `json:"event_id"`
	Type        string         `json:"type"`
	StateKey    *string        `json:"state_key"`
	Sender      string         `json:"sender"`
	Content     map[string]any `json:"content"`
	StickyUntil time.Time      `json:"-"` // exclude from JSON to avoid making the event improper/too large
}

type MemoryContentScanner

type MemoryContentScanner struct {
	T *testing.T
	// contains filtered or unexported fields
}

func NewMemoryContentScanner

func NewMemoryContentScanner(t *testing.T) *MemoryContentScanner

func (*MemoryContentScanner) Expect

func (m *MemoryContentScanner) Expect(contentType content.Type, content []byte, retClassifications []classification.Classification, retErr error)

func (*MemoryContentScanner) Scan

func (m *MemoryContentScanner) Scan(ctx context.Context, contentType content.Type, content []byte) ([]classification.Classification, error)

type MemoryPubsub

type MemoryPubsub struct {
	// contains filtered or unexported fields
}

func NewMemoryPubsub

func NewMemoryPubsub(t *testing.T) *MemoryPubsub

func (*MemoryPubsub) Close

func (m *MemoryPubsub) Close() error

func (*MemoryPubsub) Publish

func (m *MemoryPubsub) Publish(ctx context.Context, topic string, val string) error

func (*MemoryPubsub) Subscribe

func (m *MemoryPubsub) Subscribe(ctx context.Context, topic string) (<-chan string, error)

func (*MemoryPubsub) Unsubscribe

func (m *MemoryPubsub) Unsubscribe(ctx context.Context, ch <-chan string) error

type MemoryStorage

type MemoryStorage struct {
	// contains filtered or unexported fields
}

func NewMemoryStorage

func NewMemoryStorage(t *testing.T) *MemoryStorage

func (*MemoryStorage) Close

func (m *MemoryStorage) Close() error

func (*MemoryStorage) CreateCommunity

func (m *MemoryStorage) CreateCommunity(ctx context.Context, name string) (*storage.StoredCommunity, error)

func (*MemoryStorage) DeleteRoom

func (m *MemoryStorage) DeleteRoom(ctx context.Context, roomId string) error

func (*MemoryStorage) GetAllRooms

func (m *MemoryStorage) GetAllRooms(ctx context.Context) ([]*storage.StoredRoom, error)

func (*MemoryStorage) GetCommunity

func (m *MemoryStorage) GetCommunity(ctx context.Context, communityId string) (*storage.StoredCommunity, error)

func (*MemoryStorage) GetEventResult

func (m *MemoryStorage) GetEventResult(ctx context.Context, eventId string) (*storage.StoredEventResult, error)

func (*MemoryStorage) GetRoom

func (m *MemoryStorage) GetRoom(ctx context.Context, roomId string) (*storage.StoredRoom, error)

func (*MemoryStorage) GetTrustData

func (m *MemoryStorage) GetTrustData(ctx context.Context, sourceName string, key string, result any) error

func (*MemoryStorage) GetUserIdsAndDisplayNamesByRoomId

func (m *MemoryStorage) GetUserIdsAndDisplayNamesByRoomId(ctx context.Context, roomId string) ([]string, []string, error)

func (*MemoryStorage) IsUserBannedInList

func (m *MemoryStorage) IsUserBannedInList(ctx context.Context, listRoomId string, userId string) (bool, error)

func (*MemoryStorage) PopStateLearnQueue

func (*MemoryStorage) PushStateLearnQueue

func (m *MemoryStorage) PushStateLearnQueue(ctx context.Context, item *storage.StateLearnQueueItem) error

func (*MemoryStorage) SetListBanRules

func (m *MemoryStorage) SetListBanRules(ctx context.Context, listRoomId string, entityToEntityType map[string]string) error

func (*MemoryStorage) SetTrustData

func (m *MemoryStorage) SetTrustData(ctx context.Context, sourceName string, key string, data any) error

func (*MemoryStorage) SetUserIdsAndDisplayNamesByRoomId

func (m *MemoryStorage) SetUserIdsAndDisplayNamesByRoomId(ctx context.Context, roomId string, userIds []string, displayNames []string) error

func (*MemoryStorage) UpsertCommunity

func (m *MemoryStorage) UpsertCommunity(ctx context.Context, community *storage.StoredCommunity) error

func (*MemoryStorage) UpsertEventResult

func (m *MemoryStorage) UpsertEventResult(ctx context.Context, event *storage.StoredEventResult) error

func (*MemoryStorage) UpsertRoom

func (m *MemoryStorage) UpsertRoom(ctx context.Context, room *storage.StoredRoom) error

type MemoryTransaction

type MemoryTransaction struct {
	// contains filtered or unexported fields
}

func (*MemoryTransaction) Commit

func (t *MemoryTransaction) Commit() error

func (*MemoryTransaction) Rollback

func (t *MemoryTransaction) Rollback() error

type StaticMediaDownloader

type StaticMediaDownloader struct {
	T             *testing.T
	Media         map[string][]byte
	DownloadCalls int
}

func MustMakeMediaDownloader

func MustMakeMediaDownloader(t *testing.T) *StaticMediaDownloader

func (*StaticMediaDownloader) DownloadMedia

func (s *StaticMediaDownloader) DownloadMedia(ctx context.Context, origin string, mediaId string) ([]byte, error)

func (*StaticMediaDownloader) Set

func (s *StaticMediaDownloader) Set(origin string, mediaId string, bytes []byte) *StaticMediaDownloader

Jump to

Keyboard shortcuts

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