Documentation
¶
Index ¶
- func AssertFileContains(t *testing.T, path, expected string)
- func AssertFileExists(t *testing.T, path string)
- func AssertFileNotExists(t *testing.T, path string)
- func AssertGitConfigContains(t *testing.T, dir, key, expectedSubstring string)
- func AssertGitConfigNotExists(t *testing.T, dir, key string)
- func BuildBinary(t *testing.T) string
- func CleanupTestConfig(t *testing.T, configPath string)
- func CreateMultiOrgConfig(t *testing.T) string
- func CreateSimpleConfig(t *testing.T) string
- func CreateTempConfig(t *testing.T, apps []config.GitHubApp) string
- func CreateTestPrivateKey(t *testing.T) string
- func GetGitConfig(t *testing.T, dir, key string) (string, error)
- func InitGitRepo(t *testing.T, dir string)
- func ListGitConfigs(t *testing.T, dir, pattern string) []string
- func RequireEnvVar(t *testing.T, name string) string
- func RequireGit(t *testing.T)
- func SetGitConfig(t *testing.T, dir, key, value string)
- func SetupTestConfig(t *testing.T, apps []config.GitHubApp) string
- func SkipIfShort(t *testing.T, reason string)
- type ConfigBuilder
- type ErrorMode
- type JWTValidationBehavior
- type MockGitHubServer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AssertFileContains ¶
AssertFileContains asserts that a file contains a specific string
func AssertFileExists ¶
AssertFileExists asserts that a file exists
func AssertFileNotExists ¶
AssertFileNotExists asserts that a file does not exist
func AssertGitConfigContains ¶
AssertGitConfigContains asserts that git config contains a specific entry
func AssertGitConfigNotExists ¶
AssertGitConfigNotExists asserts that a git config key does not exist
func BuildBinary ¶
BuildBinary builds the gh-app-auth binary for testing
func CleanupTestConfig ¶
CleanupTestConfig cleans up test configuration
func CreateMultiOrgConfig ¶
CreateMultiOrgConfig creates a config with multiple organizations
func CreateSimpleConfig ¶
CreateSimpleConfig creates a simple config with one app
func CreateTempConfig ¶
CreateTempConfig creates a temporary config file
func CreateTestPrivateKey ¶
CreateTestPrivateKey creates a test private key file
func GetGitConfig ¶
GetGitConfig gets a git config value
func InitGitRepo ¶
InitGitRepo initializes a git repository in the given directory
func ListGitConfigs ¶
ListGitConfigs lists all git configs matching a pattern
func RequireEnvVar ¶
RequireEnvVar requires that an environment variable is set
func SetGitConfig ¶
SetGitConfig sets a git config value
func SetupTestConfig ¶
SetupTestConfig sets up a test config and returns the path
func SkipIfShort ¶
SkipIfShort skips the test if running in short mode
Types ¶
type ConfigBuilder ¶
type ConfigBuilder struct {
// contains filtered or unexported fields
}
ConfigBuilder helps build test configurations
func NewConfigBuilder ¶
func NewConfigBuilder() *ConfigBuilder
NewConfigBuilder creates a new config builder
func (*ConfigBuilder) AddApp ¶
func (cb *ConfigBuilder) AddApp(app config.GitHubApp) *ConfigBuilder
AddApp adds a GitHub App to the configuration
func (*ConfigBuilder) AddSimpleApp ¶
func (cb *ConfigBuilder) AddSimpleApp(name string, appID int64, patterns []string) *ConfigBuilder
AddSimpleApp adds a simple app with basic configuration
func (*ConfigBuilder) Build ¶
func (cb *ConfigBuilder) Build() *config.Config
Build creates the config
func (*ConfigBuilder) WriteToFile ¶
func (cb *ConfigBuilder) WriteToFile(t *testing.T, path string) string
WriteToFile writes the config to a file
type JWTValidationBehavior ¶
type JWTValidationBehavior int
JWTValidationBehavior controls JWT validation behavior
const ( JWTAcceptAll JWTValidationBehavior = iota JWTRejectAll JWTValidateFormat )
type MockGitHubServer ¶
MockGitHubServer provides a mock GitHub API server for testing
func NewMockGitHubServer ¶
func NewMockGitHubServer(t *testing.T) *MockGitHubServer
NewMockGitHubServer creates a new mock GitHub API server
func (*MockGitHubServer) Close ¶
func (m *MockGitHubServer) Close()
Close shuts down the mock server
func (*MockGitHubServer) GetURL ¶
func (m *MockGitHubServer) GetURL() string
GetURL returns the base URL of the mock server
func (*MockGitHubServer) SetErrorMode ¶
func (m *MockGitHubServer) SetErrorMode(mode ErrorMode)
SetErrorMode sets the error simulation mode
func (*MockGitHubServer) SetInstallationToken ¶
func (m *MockGitHubServer) SetInstallationToken(installationID, token string)
SetInstallationToken configures a token for a specific installation
func (*MockGitHubServer) SetJWTValidation ¶
func (m *MockGitHubServer) SetJWTValidation(behavior JWTValidationBehavior)
SetJWTValidation sets the JWT validation behavior