testutil

package
v0.0.0-...-bf444b6 Latest Latest
Warning

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

Go to latest
Published: Aug 18, 2024 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateEmail

func GenerateEmail(n int) string

GenerateEmail returns a random email address for ending with @example.com.

func GenerateRandomString

func GenerateRandomString(n int) string

GenerateRandomString generates a random string of length n.

The string is generated using the following characters:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789

The length of the string is determined by the n parameter.

The string is not guaranteed to be unique, but with a large enough n, the probability of a collision is very low.

func GenerateRandomStringAlpha

func GenerateRandomStringAlpha(n int) string

GenerateRandomStringAlpha generates a random string of length n.

The string is generated using the following characters:

abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ

The length of the string is determined by the n parameter.

The string is not guaranteed to be unique, but with a large enough n, the probability of a collision is very low.

func GenerateRandomStringNumeric

func GenerateRandomStringNumeric(n int) string

GenerateRandomStringNumeric generates a random string of length n.

The string is generated using the following characters:

0123456789

The length of the string is determined by the n parameter.

The string is not guaranteed to be unique, but with a large enough n, the probability of a collision is very low.

func NewTempFile

func NewTempFile(t *testing.T, name string, content string) string

NewTempFile creates a new temporary file with the given name and content.

func ParseLicense

func ParseLicense(t *testing.T) *license.License

ParseLicense parses the test license for testing.

Types

type ContainerIntegrationTestSuite

type ContainerIntegrationTestSuite struct {
	suite.Suite
	// contains filtered or unexported fields
}

ContainerIntegrationTestSuite is a test suite which uses a container to run tests.

func (*ContainerIntegrationTestSuite) AddContainer

func (s *ContainerIntegrationTestSuite) AddContainer(container testcontainers.Container)

AddContainer adds a container to the list of containers to be cleaned up after the test.

func (*ContainerIntegrationTestSuite) CleanupContainers

func (s *ContainerIntegrationTestSuite) CleanupContainers()

CleanupContainers cleans up any containers created during the test.

type Neo4jContainerIntegrationTestSuite

type Neo4jContainerIntegrationTestSuite struct {
	Neo4jDB *neo4j.Database

	AssignmentRepo   *neo4j.AssignmentRepository
	AttachmentRepo   *neo4j.AttachmentRepository
	CommentRepo      *neo4j.CommentRepository
	DocumentRepo     *neo4j.DocumentRepository
	IssueRepo        *neo4j.IssueRepository
	LabelRepo        *neo4j.LabelRepository
	LicenseRepo      *neo4j.LicenseRepository
	NamespaceRepo    *neo4j.NamespaceRepository
	OrganizationRepo *neo4j.OrganizationRepository
	PermissionRepo   *neo4j.PermissionRepository
	ProjectRepo      *neo4j.ProjectRepository
	RoleRepo         *neo4j.RoleRepository
	TodoRepo         *neo4j.TodoRepository
	UserRepo         *neo4j.UserRepository
}

Neo4jContainerIntegrationTestSuite is a test suite which sets up a Neo4j container to run tests.

func (*Neo4jContainerIntegrationTestSuite) BootstrapNeo4jDatabase

func (*Neo4jContainerIntegrationTestSuite) CleanupNeo4j

func (*Neo4jContainerIntegrationTestSuite) SetupNeo4j

type PgContainerIntegrationTestSuite

type PgContainerIntegrationTestSuite struct {
	PostgresDB *pg.Database

	NotificationRepo *pg.NotificationRepository
}

PgContainerIntegrationTestSuite is a test suite which sets up a Postgres container to run tests.

func (*PgContainerIntegrationTestSuite) BootstrapPgDatabase

func (*PgContainerIntegrationTestSuite) CleanupPg

func (*PgContainerIntegrationTestSuite) SetupPg

type RedisContainerIntegrationTestSuite

type RedisContainerIntegrationTestSuite struct {
	RedisDB   *redis.Database
	RedisConf *config.CacheDatabaseConfig

	CachedTodoRepo *redis.CachedTodoRepository
}

RedisContainerIntegrationTestSuite is a test suite which sets up a Redis container to run tests.

func (*RedisContainerIntegrationTestSuite) CleanupRedis

func (*RedisContainerIntegrationTestSuite) GetKeys

func (*RedisContainerIntegrationTestSuite) SetupRedis

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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