Documentation
¶
Index ¶
Constants ¶
View Source
const ( TestEmail = "test@codesphere.com" TestTeamName = "Tests" // Default connection parameters. DefaultPort = 5432 DefaultUser = "postgres" DefaultDBName = "codesphere" DefaultSSLMode = "disable" )
Variables ¶
This section is empty.
Functions ¶
func HashAPIToken ¶
HashAPIToken hashes an API token using a single SHA256 with no additional salt.
func LogAndPersistResult ¶
func LogAndPersistResult(result *TestUserResult, workdir string)
LogAndPersistResult writes the test user result to a JSON file and logs the credentials.
func WriteResultToFile ¶
func WriteResultToFile(result *TestUserResult, dir string) (string, error)
WriteResultToFile writes the test user result to a JSON file in the given directory.
Types ¶
type CreateTestUserOpts ¶
type CreateTestUserOpts struct {
Host string
Port int
User string
Password string
DBName string
SSLMode string
}
CreateTestUserOpts contains the options for creating a test user.
type TestUserCreator ¶
type TestUserCreator struct {
// contains filtered or unexported fields
}
TestUserCreator manages the lifecycle of test user creation.
func New ¶
func New(opts CreateTestUserOpts) (*TestUserCreator, error)
New creates a new TestUserCreator with the given options.
func (*TestUserCreator) Create ¶
func (c *TestUserCreator) Create() (*TestUserResult, error)
Create generates credentials and inserts the test user into the database.
type TestUserResult ¶
type TestUserResult struct {
Email string `json:"email"`
PlaintextPassword string `json:"password"`
PlaintextAPIToken string `json:"api_token"`
}
TestUserResult contains the result of creating a test user.
func CreateTestUser ¶
func CreateTestUser(opts CreateTestUserOpts) (*TestUserResult, error)
CreateTestUser is a convenience facade: New -> Create -> close.
Click to show internal directories.
Click to hide internal directories.